<template>
    <div class="main-contents-box">
        <div class="main-contents-main">
            <div class="power">
                <ul>
                    <threelectric1 @three-more="threeclick" v-for="items in threeInfo"
                            v-if="items['pluginid'] == 327937? true:false"
                            :three-info="items" :three-data="threeData[items.deviceid]"></threelectric1>

                    <threelectric2 @three-more="threeclick" v-for="items in threeInfo"
                            v-if="items['pluginid'] == 327938? true:false"
                            :three-info="items" :three-data="threeData[items.deviceid]"></threelectric2>
                    <!--前两种UPS-->
                    <ups v-if="item['pluginid'] == 131841? false:true" v-for="item in UPSInfo" @on-see="batteryclick"
                            @on-more="uspmore" :style="{left:item.x+'px',top:item.y+'px'}"
                            :ups-data="item"
                            :ups-num="(upsAlarm[item.deviceid]?(upsAlarm[item.deviceid].numbersa?upsAlarm[item.deviceid].numbersa:0):'')"
                            :ups-alarm="(upsAlarm[item.deviceid]?upsAlarm[item.deviceid]:'')"></ups>

                    <!--第三种UPS-->
                    <ups2 v-if="item['pluginid'] == 131841? true:false" v-for="item in UPSInfo"
                            :style="{left:item.x+'px',top:item.y+'px'}"
                            :ups-data="item"
                            :ups-num="(upsAlarm[item.deviceid]?(upsAlarm[item.deviceid].numbersa?upsAlarm[item.deviceid].numbersa:0):'')"
                            :ups-alarm="(upsAlarm[item.deviceid]?upsAlarm[item.deviceid]:'')"></ups2>

                    <alternator v-if="item['pluginid'] == 786689? true:false" v-for="item in alternatorInfo"
                            @on-see="alternatorSee"
                            @on-more="alternatormore" :style="{left:item.x+'px',top:item.y+'px'}"
                            :alternator-data="item"
                            :alternator-num="(alternatorAlarm[item.deviceid]?(alternatorAlarm[item.deviceid].numbersa?alternatorAlarm[item.deviceid].numbersa:0):'')"
                            :alternator-alarm="(alternatorAlarm[item.deviceid]?alternatorAlarm[item.deviceid]:'')"></alternator>

                    <alternator2 v-if="item['pluginid'] == 786690? true:false" v-for="item in alternatorInfo"
                            @on-see2="alternatorSee2"
                            @on-more2="alternatormore2" :style="{left:item.x+'px',top:item.y+'px'}"
                            :alternator-data="item"
                            :alternator-num="(alternatorAlarm2[item.deviceid]?(alternatorAlarm2[item.deviceid].numbersa?alternatorAlarm2[item.deviceid].numbersa:0):'')"
                            :alternator-alarm="(alternatorAlarm2[item.deviceid]?alternatorAlarm2[item.deviceid]:'')"></alternator2>

                    <leakage v-if="item['pluginid'] == 852225? true:false" v-for="item in leakageInfo"
                            @on-more="leakagemore"
                            :style="{left:item.x+'px',top:item.y+'px'}" :leakage-data="item"
                            :leakage-num="(leakageAlarm[item.deviceid]?(leakageAlarm[item.deviceid].numbersa?leakageAlarm[item.deviceid].numbersa:0):'')"
                            :leakage-alarm="(leakageAlarm[item.deviceid]?leakageAlarm[item.deviceid]:'')"></leakage>

                    <!-- 电量检测器主模块 -->
                    <electricMonitor v-if="item['pluginid'] == 983297 ? true:false" v-for="item in electricMonitorInfo"
                            :style="{left:item.x+'px',top:item.y+'px'}" :electricmonitor-data="item"
                            :electricmonitor-alarm="(electricMonitorAlarm[item.deviceid]?electricMonitorAlarm[item.deviceid]:'')">
                    </electricMonitor>

                    <!-- 电量检测器从模块 -->
                    <electricMonitor2 v-if="item['pluginid'] == 983298 ? true:false" v-for="item in electricMonitorInfo"
                            :style="{left:item.x+'px',top:item.y+'px'}" :electricmonitor-data="item"
                            :electricmonitor-alarm="(electricMonitorAlarm2[item.deviceid]?electricMonitorAlarm2[item.deviceid]:'')">
                    </electricMonitor2>

                    <li v-if="isElectric" v-for="(items,index) in electricList"
                            :style="{left:items.x+'px',top:items.y+'px'}">
                        <electric :electric-items="items" :electric-index="index"
                                @electric-change="set_status"></electric>
                    </li>

                    <!-- 蓄电池智能传感器-->
                    <li v-if="isBatterySensor" v-for="(items,index) in batterySonsorList"
                            :style="{left:items.x+'px',top:items.y+'px'}">
                        <electric :electric-items="items" :electric-index="index"
                                @electric-change="set_statusbattery"></electric>
                    </li>
                </ul>
                <div class="buttons-box">
                    <el-button type='primary' @click="edit" size="small">{{btnname}}</el-button>
                </div>
            </div>

            <backdrop :is-show="isShowRegDialog1" @on-close="closeDialog('isShowRegDialog1')">
                <batteryb :popup-data='popupdata' :staus="upsAlarm1" :stauss="upsAlarm2" v-loading="loading2"
                        element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
                        element-loading-background="rgba(0, 0, 0, 0.8)"></batteryb>
            </backdrop>

            <!-- 发电机报警数查看 -->
            <backdrop :is-show="alternatorDialog" @on-close="closeDialog('alternatorDialog')">
                <alternatorSee :alternator-data='alternatordata' :stausa="alternatorAlarm11"
                        :stausaa="alternatorAlarm12"
                        :stausaaa="alternatorAlarm13" :stausaaaa="alternatorAlarm14"
                        :stausaaaaa="alternatorAlarm15" v-loading="loading12"
                        element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
                        element-loading-background="rgba(0, 0, 0, 0.8)"></alternatorSee>
            </backdrop>

            <!-- 发电机报警数查看2 -->
            <backdrop :is-show="alternatorDialog2" @on-close="closeDialog('alternatorDialog2')">
                <alternatorSee2 :alternator-data='alternatordata' :stausa="alternatorAlarm11"
                        :stausaa="alternatorAlarm12"
                        :stausaaa="alternatorAlarm13" :stausaaaa="alternatorAlarm14"
                        :stausaaaaa="alternatorAlarm15" v-loading="loading12"
                        element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
                        element-loading-background="rgba(0, 0, 0, 0.8)"></alternatorSee2>
            </backdrop>

            <backdrop :is-show="isShowRegDialog2" @on-close="closeDialog('isShowRegDialog2')">
                <threeb></threeb>
            </backdrop>
            <backdrop :is-show="isShowRegDialog3" @on-close="closeDialog('isShowRegDialog3')">
                <upsmore :moreupper="moreupper"></upsmore>
            </backdrop>

            <!-- 发电机更多 -->
            <backdrop :is-show="alternatorDialog13" @on-close="closeDialog('alternatorDialog13')">
                <alternatormore :morealternator="morealternator" :morealternators="morealternators"
                        :morealternatorss="morealternatorss"
                        :morealternatorsss="morealternatorsss"></alternatormore>
            </backdrop>

            <!-- 发电机2更多 -->
            <backdrop :is-show="alternatorDialog132" @on-close="closeDialog('alternatorDialog132')">
                <alternatormore2 :morealternator2="morealternator2" :morealternators2="morealternators2"
                        :morealternatorss2="morealternatorss2"
                        :morealternatorsss2="morealternatorsss2"></alternatormore2>
            </backdrop>

            <!-- 漏电模块更多 -->
            <backdrop :is-show="leakageDialog13" @on-close="closeDialog('leakageDialog13')">
                <leakagemore :moreleakage="moreleakage" :moreleakages="moreleakages"
                        :moreleakagess="moreleakagess"></leakagemore>
            </backdrop>

            <!--电量监测主模块更多 -->
            <backdrop :is-show="electricMitorlog13" @on-close="closeDialog('electricMitorlog13')">
                <electricMonitormore :moreelectricMoitor="moreelectricMoitor" :moreelectricMoitors="moreelectricMoitors"
                        :moreelectricMoitorss="moreelectricMoitorss"
                        :moreelectricMoitorsss="moreelectricMoitorsss">
                </electricMonitormore>
            </backdrop>

            <!--电量监测从模块2更多 -->
            <backdrop :is-show="electricMitorlog132" @on-close="closeDialog('electricMitorlog132')">
                <electricMonitormore2 :moreelectricMoitor2="moreelectricMoitor2"
                        :moreelectricMoitors2="moreelectricMoitors2"
                        :moreelectricMoitorss2="moreelectricMoitorss2"
                        :moreelectricMoitorsss2="moreelectricMoitorsss2">
                </electricMonitormore2>
            </backdrop>

        </div>
    </div>
</template>
<script>
import backdrop from "../Monitornr/tem/backdrop.vue"
import powerb from "../Monitornr/tem/powerb.vue"
import batteryb from "../Monitornr/tem/batteryb.vue"
import threeb from "../Monitornr/tem/threeb.vue"
import threelectric1 from "../Monitornr/tem/threelectric1.vue"
import threelectric2 from "../Monitornr/tem/threelectric2.vue"

import ups from "../Monitornr/tem/ups.vue"
import ups2 from "../Monitornr/tem/ups2.vue"

import upsmore from "../Monitornr/tem/upsmore.vue"
import electric from "../Monitornr/tem/electric.vue"
import {
    show_ups_float_param2,
    show_ups_more_float_param2,
    show_ups_boole_param2,
    show_alternator_float_param1,
    show_alternator_more_float_param1,
    show_alternator_boole_param1,
    show_alternator_more_float_param2,
    show_alternator_boole_param2,
    show_leakage_float_param1,
    show_leakage_more_float_param2,
    show_electricMonitor_float_param,
    show_electricMonitor_more_float_param
} from "../../js/public.js"

import alternator from "../Monitornr/tem/alternator.vue"
import alternator2 from "../Monitornr/tem/alternator2.vue"
import alternatorSee from "../Monitornr/tem/alternatorSee.vue"
import alternatorSee2 from "../Monitornr/tem/alternatorSee2.vue"
import alternatormore from "../Monitornr/tem/alternatormore.vue"
import alternatormore2 from "../Monitornr/tem/alternatormore2.vue"
import leakage from "../Monitornr/tem/leakage.vue"
import leakagemore from "../Monitornr/tem/leakagemore.vue"
// 蓄电池智能传感器
import batterySencor from "../Monitornr/tem/batterySensor.vue"
// 电量检测器
import electricMonitor from "../Monitornr/tem/electricMonitor.vue"
import electricMonitormore from "../Monitornr/tem/electricMonitormore.vue"
import electricMonitor2 from "../Monitornr/tem/electricMonitor2.vue"
import electricMonitormore2 from "../Monitornr/tem/electricMonitormore2.vue"

import newAddAlternator from "../Monitornr/tem/newAddAlternator"
/*ups页面点击更多的时候从这个页面获取数据，然后 传送到更多的页面内进行赋值操作*/
export default {
    components: {
        backdrop,
        powerb,
        batteryb,
        threeb,
        threelectric1,
        threelectric2,
        ups,
        ups2,
        upsmore,
        electric,
        alternator,
        alternator2,
        alternatorSee,
        alternatorSee2,
        alternatormore,
        alternatormore2,
        leakage,
        leakagemore,
        batterySencor,
        electricMonitor,
        electricMonitormore,
        electricMonitor2,
        electricMonitormore2
    },
    name: 'power',
    data() {
        return {
            switech: '开',
            switech1: '关',
            isShowRegDialog: false,
            isShowRegDialog1: false,
            alternatorDialog: false,
            alternatorDialog2: false,
            isShowRegDialog2: false,
            isShowRegDialog3: false,
            alternatorDialog13: false,
            alternatorDialog132: false,
            leakageDialog: false,
            leakageDialog13: false,
            electricMitorlog13: false,
            electricMitorlog132: false,

            btnname: "编辑",
            loading2: true,

            loading12: true,
            states: false,
            electricList: [],
            threeData: [],
            threeInfo: {},
            threeArr1: [],
            threeArr2: [],
            UPSData: [{
                name: "输入电压(V)",
                value: ''
            },
                {
                    name: "输入频率(HZ)",
                    value: ''
                },
                {
                    name: "输出电压(V)",
                    value: ''
                },
                {
                    name: "温度(℃)",
                    value: ''
                }
            ],
            UPSInfo: [],
            upsAlarm: [],
            upsAlarm1: [],
            upsAlarm2: [],
            upsArr2: [], //pluginid为131585型号的ups

            electricList: [],

            alternatorInfo: [], //存储发电机的位置,名称,deviceid等信息
            alternatorAlarm: [],
            alternatorAlarm2: [],
            alternatorAlarm11: [],
            alternatorAlarm12: [],
            alternatorAlarm13: [],
            alternatorAlarm14: [],
            alternatorAlarm15: [],

            leakageInfo: [], //存储漏电模块的位置,名称,deviceid等信息
            leakageAlarm: [],
            leakageAlarm2: [],
            leakageAlarm11: [],
            leakageAlarm12: [],
            leakageAlarm13: [],
            leakageAlarm14: [],
            leakageAlarm15: [],
            leakageArr: [], //pluginid为852225型号的漏电模块
            leakageArr1: [],
            leakageArr2: [],

            alternatorArr1: [], //pluginid为786689型号的发电机
            alternatorArr2: [], //pluginid为786690型号的发电机

            batterySonsorList: [],

            electricmonitorData: [], //存储电量监测模块的位置
            electricMonitorInfo: [],
            electricMonitorAlarm: [], //存放pluginid为983297型号的报警信息
            electricMonitorAlarm2: [], //存放pluginid为983298型号的报警信息
            electricMoitorAtrr: [],
            electricMoitorAtrr1: [], //pluginid为983297型号的电量检测器
            electricMoitorAtrr2: [], //pluginid为983298型号的电量检测器

            moreupper: {},
            morelower: {},
            morealternator: {},
            morealternators: {},
            morealternatorss: {},
            morealternatorsss: {},

            morealternator2: {},
            morealternators2: {},
            morealternatorss2: {},
            morealternatorsss2: {},

            moreleakage: {},
            moreleakages: {},
            moreleakagess: {},

            moreelectricMoitor: {},
            moreelectricMoitors: {},
            moreelectricMoitorss: {},
            moreelectricMoitorsss: {},

            moreelectricMoitor2: {},
            moreelectricMoitors2: {},
            moreelectricMoitorss2: {},
            moreelectricMoitorsss2: {},

            popupdata: [],
            alternatordata: [],
            alternatordata2: [],
            leakagedata: [],
            leakagedata2: [],
            switch_status: 0, //ups标记"弹窗"是否开启的状态
            switch_deviceid: null, //ups标记打开的是哪个设备
            alternator_status: 0, //发电机标记"弹窗"是否开启的状态
            alternator_status2: 0, //发电机标记"弹窗"是否开启的状态
            electricMonitor_status: 0, //电量监测器"弹窗"时候开启的状态
            electricMonitor_status2: 0,
            leakage_status: 0, //漏电模块标记"弹窗"是否开启的状态
            leakage_status2: 0,

            leakage_deviceid: null, //漏电模块标记打开的是哪个设备
            alternator_deviceid: null, //发电机标记打开的是哪个设备
            alternator_deviceid2: null, //发电机标记打开的是哪个设备
            electricMonitor_deviceid: null, //标记电量检测器打开的是哪个设备
            electricMonitor_deviceid2: null, //标记电量监测器打开的是哪个设备
            electric_arr: [], //市电的deviceid
            three_arr: [],
            ups_arr: [],
            alternator_arr: [],
            leakage_arr: [],
            batterySencor_arr: [], //蓄电池智能传感器
            electricMonitor_arr: [], //电量监测

            type: '',
            isUPS: false,
            isThree: false,
            isElectric: false,
            isAlternator: false,
            isLeakage: false,
            isBatterySensor: false
        }
    },
    methods: {
        regClick() {
            this.$data.isShowRegDialog = true
        },
        closeDialog(attr) {
            this.$data.switch_status = 0;
            this.$data.switch_deviceid = null;
            this.$data.loading2 = true;
            this.$data.upsAlarm1 = [];
            this.$data.upsAlarm2 = [];

            this.$data.alternator_status = 0;
            this.$data.alternator_status2 = 0;
            this.$data.leakage_status = 0;
            this.$data.alternator_deviceid = null;

            this.$data.electricMonitor_deviceid = null;

            this.$data.leakage_deviceid = null;
            this.$data.loading12 = true;
            this.$data.alternatorAlarm11 = [];
            this.$data.alternatorAlarm12 = [];
            this.$data.alternatorAlarm13 = [];
            this.$data.alternatorAlarm14 = [];
            this.$data.alternatorAlarm15 = [];
            this.$data.leakageAlarm = [];
            this.$data.leakageAlarm11 = [];
            this.$data.leakageAlarm12 = [];
            this.$data.leakageAlarm13 = [];
            this.$data.leakageAlarm14 = [];
            this.$data.leakageAlarm15 = [];

            this.$data.electricMonitorAlarm = [];
            this.$data.electricMonitorAlarm2 = [];

            this[attr] = false;
        },
        threeclick() {
            this.$data.isShowRegDialog2 = true
        },
        set_status(msga) { /* 市电状态*/
            clearInterval(electric_interval);

            let msg, alarm;
            let that = this;
            if (msga.status == true) {
                msg = {
                    "cmd": "CGI_MONITOR_SET_CTRL",
                    "did": msga.deviceid,
                    "cid": 393217
                };
                alarm = "启动" + msga.name;
            } else {
                msg = {
                    "cmd": "CGI_MONITOR_SET_CTRL",
                    "did": msga.deviceid,
                    "cid": 393218
                };
                alarm = "切断" + msga.name;
            }

            this.$confirm('此操作将' + alarm + ', 是否继续?', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                $.ajax({
                    url: "cgi-bin/main.cgi",
                    contentType: "application/json;charset=utf-8",
                    type: "post",
                    data: JSON.stringify(msg),
                    success: function (msg) {
                        let data = eval("(" + msg + ")");
                        if (data.response == true) {
                            that.$message({
                                type: 'success',
                                message: '设置成功!'
                            });
                        } else {
                            that.$message({
                                type: 'error',
                                message: data.errlog
                            });
                        }
                        electric_interval = setInterval(this.get_electric_info, 2000);

                        setTimeout(electric_interval, 2000);

                    }
                })
            }).catch(() => {
                that.$data.electricList[msga.index].isActive = !status;
                electric_interval = setInterval(this.get_electric_info, 2000);
                setTimeout(electric_interval, 2000);
            });
        },
        get_pwd() {
            let pwd;
            $.ajax({
                url: '../cfg/password.json',
                type: 'GET',
                cache: false,
                async: false,
                dataType: 'text',
                success: function (result) {
                    let data = eval("(" + result + ")");
                    pwd = data.password;
                },
                error: function (realdata) {
                }
            })
            return pwd;
        },
        check_pwd() {
            let username = window.sessionStorage.getItem('username');
            let password = window.sessionStorage.getItem('password');
            let pwd = this.get_pwd();
            if (username == "admin") {
                if (password != pwd) {
                    this.$message({
                        message: '密码做了更改,请重新登录!',
                        type: 'info',
                        center: true,
                        showClose: true
                    });
                    this.loginout();
                }
            }
        },
        loginout() {
            window.sessionStorage.removeItem("username");
            window.sessionStorage.removeItem("password");

            this.set_log("用户退出");
            this.$router.push("/login");
        },
        set_log(str) { //用户操作日志
            let msg = {
                "cmd": "CGI_LOG_SET_OPT",
                "content": str
            };
            $.ajax({
                url: "cgi-bin/main.cgi",
                contentType: "application/json;charset=utf-8",
                type: "post",
                data: JSON.stringify(msg),
                success: function (msg) {
                }
            })
        },
        moves() {
            let that = this;
            $(".power ul li").draggable({
                containment: "parent",
                stop() {
                    let lefts, tops, deviceid;
                    lefts = parseInt($(this).css("left"));
                    tops = parseInt($(this).css("top"));
                    deviceid = $(this).find(".isid").text();
                    $.each(that.$data.UPSInfo, function (i, value) {
                        if (value.deviceid == deviceid) {
                            value.x = lefts;
                            value.y = tops;
                            return false;
                        }
                    });
                    $.each(that.$data.threeInfo, function (i, value) {
                        if (value.deviceid == deviceid) {
                            value.x = lefts;
                            value.y = tops;
                            return false;
                        }
                    });
                    $.each(that.$data.electricList, function (i, value) {
                        if (value.deviceid == deviceid) {
                            value.x = lefts;
                            value.y = tops;
                            return false;
                        }
                    });
                    $.each(that.$data.alternatorInfo, function (i, value) {
                        if (value.deviceid == deviceid) {
                            value.x = lefts;
                            value.y = tops;
                            return false;
                        }
                    });
                    $.each(that.$data.leakageInfo, function (i, value) {
                        if (value.deviceid == deviceid) {
                            value.x = lefts;
                            value.y = tops;
                            return false;
                        }
                    });
                    $.each(that.$data.electricMonitorInfo, function (i, value) {
                        if (value.deviceid == deviceid) {
                            value.x = lefts;
                            value.y = tops;
                            return false;
                        }
                    });
                    $.each(that.$data.batterySonsorList, function (i, value) {
                        if (value.deviceid == deviceid) {
                            value.x = lefts;
                            value.y = tops;
                            return false;
                        }
                    });
                }
            });
            $(".power ul li").draggable("disable");
        },
        edit() {
            this.$data.states = !this.$data.states;
            let that = this;
            if (this.$data.states) {
                this.$data.btnname = '保存';
                $(".power ul li").draggable("enable");
            } else {
                $(".power ul li").draggable("disable");
                this.$data.btnname = '编辑';

                //整合拖动后的位置信息下发
                let position_arr = new Array();
                //市电的位置
                $.each(that.$data.electricList, function (i, value) {
                    let str = {
                        "deviceid": value.deviceid,
                        "x": value.x,
                        "y": value.y
                    };
                    position_arr.push(str);
                })

                //ups位置
                $.each(that.$data.UPSInfo, function (i, value) {
                    let ups_str = {
                        "deviceid": value.deviceid,
                        "x": value.x,
                        "y": value.y
                    };
                    position_arr.push(ups_str);
                });

                //三相电位置
                $.each(that.$data.threeInfo, function (i, value) {
                    let three_str = {
                        "deviceid": value.deviceid,
                        "x": value.x,
                        "y": value.y
                    };
                    position_arr.push(three_str);
                })

                //发电机位置
                $.each(that.$data.alternatorInfo, function (i, value) {
                    let alternator_str = {
                        "deviceid": value.deviceid,
                        "x": value.x,
                        "y": value.y
                    };
                    position_arr.push(alternator_str);
                })

                //漏电模块位置
                $.each(that.$data.leakageInfo, function (i, value) {
                    let leakage_str = {
                        "deviceid": value.deviceid,
                        "x": value.x,
                        "y": value.y
                    };
                    position_arr.push(leakage_str);
                })

                //蓄电池智能传感器模块位置
                $.each(that.$data.batterySonsorList, function (i, value) {
                    let batterySensor_str = {
                        "deviceid": value.deviceid,
                        "x": value.x,
                        "y": value.y
                    };
                    position_arr.push(batterySensor_str);
                })

                //电量监测器模块位置
                $.each(that.$data.electricMonitorInfo, function (i, value) {
                    let electricMonitor_str = {
                        "deviceid": value.deviceid,
                        "x": value.x,
                        "y": value.y
                    };
                    position_arr.push(electricMonitor_str);
                })

                let msg = {
                    "cmd": "CGI_MONITOR_SET_POS",
                    "device": position_arr
                };
                $.ajax({
                    url: "cgi-bin/main.cgi",
                    contentType: "application/json;charset=utf-8",
                    type: "post",
                    data: JSON.stringify(msg),
                    success: function (msg) {
                        let data = eval("(" + msg + ")");
                        if (data.response == true) {
                            that.$message({
                                message: '传感器位置设置成功!',
                                type: 'success',
                                center: true,
                                showClose: true
                            });
                        } else {
                            that.$message({
                                message: data.errlog,
                                type: 'error',
                                center: true,
                                showClose: true
                            });
                        }
                    }
                })
            }
        },
        get_info() {
            let that = this;
            let get_env_msg = {
                "cmd": "CGI_MONITOR_GET_ENV",
                "sensorlist": [2, 5, 6, 12, 13, 14, 15]
            };
            if (window.sessionStorage.getItem('username') == "zyl") {
                $.ajax({
                    url: "../static/get_env_power.json",
                    contentType: "application/json;charset=utf-8",
                    type: "get",
                    dataType: 'text',
                    cache: false,
                    async: false,
                    success: function (msg) {
                        let res = eval("(" + msg + ")");

                        //判断是否存在某类传感器，需要判断数据是不是存在
                        if (res["6"] == undefined) { //判断市电是否存在
                            that.$data.electricList = [];
                            that.$data.isElectric = false;
                        } else {
                            that.$data.isElectric = true;
                            let electric_arr = new Array();
                            //that.$data.waters = res["1"];
                            $.each(res['6'], function (n, value) {
                                electric_arr.push(value.deviceid);
                            });

                            //将包含市电的deviceid数组赋值到electric_arr中，以便获取当状态
                            that.$data.electric_arr = electric_arr;
                            let real_msg = {
                                "devicelist": electric_arr
                            };
                            $.ajax({
                                url: '../static/get_env_electricdata.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let realdata = eval("(" + result + ")");
                                    $.each(res["6"], function (i, value) { //判读市电是否存在
                                        if (value["393216"] == true) {
                                            value["isActive"] = false;
                                            value["isnull"] = true;
                                            //value["brief"] = "采集超时";
                                        } else {
                                            if (realdata[value.deviceid]["393217"] == 1) { //告警
                                                value["isActive"] = true;
                                            } else { //不告警
                                                value["isActive"] = false;
                                            }
                                            value["isnull"] = false;
                                            //value["brief"] = "";
                                        }
                                        res["6"][i] = value;
                                    });
                                    that.$data.electricList = res["6"];
                                },
                                error: function (realdata) {
                                }
                            });
                        }

                        if (res["5"] == undefined) { //判断三相电是否存在
                            that.$data.threeInfo = [];
                            that.$data.threeData = [];
                            that.$data.isThree = false;
                        } else {
                            that.$data.isThree = true;
                            let three_arr = new Array();

                            let three_arr1 = new Array(); //pluginid 为 327937
                            let three_arr2 = new Array(); //pluginid 为 327938

                            //三相电的名称位置赋值
                            that.$data.threeInfo = res["5"];

                            $.each(res['5'], function (n, value) {
                                three_arr.push(value.deviceid);

                                if (value.pluginid == 327937) {
                                    three_arr1.push(value.deviceid);
                                }

                                if (value.pluginid == 327938) {
                                    three_arr2.push(value.deviceid);
                                }
                            });

                            //将分类的数据赋予变量中
                            that.$data.threeArr1 = three_arr1;
                            that.$data.threeArr2 = three_arr2;

                            //将包含三相电的deviceid数组赋值到什么three_arr中，以便获取当状态
                            that.$data.three_arr = three_arr;

                            let real_msg = {
                                "devicelist": three_arr
                            };
                            $.ajax({
                                url: '../static/get_env_threedata.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let realdata = eval("(" + result + ")");
                                    $.each(realdata, function (i, value) {

                                        var index1 = $.inArray(parseInt(i), three_arr1);
                                        var index2 = $.inArray(parseInt(i), three_arr2);
                                        if (index1 >= 0) { //属于插件pluginid为327937的传感器
                                                let threedata_arr = new Array();
                                                let arr1 = new Array();
                                                let arr2 = new Array();
                                                let arr3 = new Array();

                                            if (value["327680"] == true) {
                                                arr1["name"] = "A相";
                                                arr1["voltage"] = "error";
                                                arr1["current"] = "error";
                                                arr2["name"] = "B相";
                                                arr2["voltage"] = "error";
                                                arr2["current"] = "error";
                                                arr3["name"] = "C相";
                                                arr3["voltage"] = "error";
                                                arr3["current"] = "error";
                                                //value["brief"] = "采集超时";
                                            } else {
                                                arr1["name"] = "A相";
                                                if (typeof (value["327681"]) == "number") {
                                                    arr1["voltage"] = value["327681"].toFixed(2);
                                                } else {
                                                    arr1["voltage"] = "error";
                                                }
                                                if (typeof (value["327684"]) == "number") {
                                                    arr1["current"] = value["327684"].toFixed(2);
                                                } else {
                                                    arr1["current"] = "error";
                                                }
                                                arr2["name"] = "B相";
                                                if (typeof (value["327682"]) == "number") {
                                                    arr2["voltage"] = value["327682"].toFixed(2);
                                                } else {
                                                    arr2["voltage"] = "error";
                                                }
                                                if (typeof (value["327685"]) == "number") {
                                                    arr2["current"] = value["327685"].toFixed(2);
                                                } else {
                                                    arr2["current"] = "error";
                                                }
                                                arr3["name"] = "C相";
                                                if (typeof (value["327683"]) == "number") {
                                                    arr3["voltage"] = value["327683"].toFixed(2);
                                                } else {
                                                    arr3["voltage"] = "error";
                                                }
                                                if (typeof (value["327686"]) == "number") {
                                                    arr3["current"] = value["327686"].toFixed(2);
                                                } else {
                                                    arr3["current"] = "error";
                                                }
                                            }
                                            threedata_arr[0] = arr1;
                                            threedata_arr[1] = arr2;
                                            threedata_arr[2] = arr3;

                                            that.$data.threeData[i] = threedata_arr;
                                        }

                                        if (index2 >= 0) { //属于插件pluginid为327938的传感器
                                            let threedata_arr = new Array();
                                            let arr1 = new Array();
                                            let arr2 = new Array();
                                            let arr3 = new Array();

                                            if (value["327680"] == true) {
                                                arr1["name"] = "AB线";
                                                arr1["voltage"] = "error";
                                                arr1["current"] = "error";
                                                arr2["name"] = "BC线";
                                                arr2["voltage"] = "error";
                                                arr2["current"] = "error";
                                                arr3["name"] = "CA线";
                                                arr3["voltage"] = "error";
                                                arr3["current"] = "error";
                                                //value["brief"] = "采集超时";
                                            } else {
                                                arr1["name"] = "AB线";
                                                if (typeof (value["327687"]) == "number") {
                                                    arr1["voltage"] = value["327687"].toFixed(2);
                                                } else {
                                                    arr1["voltage"] = "error";
                                                }
                                                if (typeof (value["327684"]) == "number") {
                                                    arr1["current"] = value["327684"].toFixed(2);
                                                } else {
                                                    arr1["current"] = "error";
                                                }

                                                arr2["name"] = "BC线";

                                                if (typeof (value["327688"]) == "number") {
                                                    arr2["voltage"] = value["327688"].toFixed(2);
                                                } else {
                                                    arr2["voltage"] = "error";
                                                }
                                                if (typeof (value["327685"]) == "number") {
                                                    arr2["current"] = value["327685"].toFixed(2);
                                                } else {
                                                    arr2["current"] = "error";
                                                }

                                                arr3["name"] = "CA线";
                                                if (typeof (value["327689"]) == "number") {
                                                    arr3["voltage"] = value["327689"].toFixed(2);
                                                } else {
                                                    arr3["voltage"] = "error";
                                                }
                                                if (typeof (value["327686"]) == "number") {
                                                    arr3["current"] = value["327686"].toFixed(2);
                                                } else {
                                                    arr3["current"] = "error";
                                                }
                                            }
                                            threedata_arr[0] = arr1;
                                            threedata_arr[1] = arr2;
                                            threedata_arr[2] = arr3;

                                            that.$data.threeData[i] = threedata_arr;
                                        }

                                    })
                                },
                                error: function (realdata) {
                                }
                            })
                        }


                        if (res["2"] == undefined) { //判断UPS是否存在
                            that.$data.UPSInfo = [];
                            that.$data.UPSData = [];
                            that.$data.isUPS = false;
                            that.$data.isUPS2 = false;
                        } else {
                            that.$data.isUPS = true;
                            let ups_arr = new Array();

                            let ups_arr2 = new Array(); //pluginid 为 131585
                            //UPS的名称位置赋值
                            that.$data.UPSInfo = res["2"];
                            $.each(res['2'], function (n, value) {
                                ups_arr.push(value.deviceid);
                                if (value.pluginid == 131585) {
                                    ups_arr2.push(value.deviceid);
                                }
                            });

                            //将分类的数组赋予变量中,用于实时刷新数据中使用
                            that.$data.upsArr2 = ups_arr2;

                            //将包含ups的deviceid数组赋值到什么ups_arr中，以便获取当状态
                            that.$data.ups_arr = ups_arr;
                            let real_msg = {
                                "devicelist": ups_arr
                            };

                            $.ajax({
                                url: '../static/get_env_upsdata.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let data = eval("(" + result + ")");

                                    let ii = 0;
                                    $.each(data, function (i, value) {

                                        var index2 = $.inArray(parseInt(i), ups_arr2);
                                        if (index2 >= 0) { //属于插件pluginid为131585的传感器

                                            let ele_mode; //供电方式
                                            let device_status; //开机状态
                                            let ele_status; //电池充电状态
                                            let voltage_status; //蓄电池电压状态

                                            let more_float_arr2 = show_ups_more_float_param2();
                                            let boole_arr2 = show_ups_boole_param2();

                                            if (typeof (value["131090"]) != "number" && typeof (value["131090"]) != "boolean") {
                                                device_status = "error";
                                            } else {
                                                if (value["131090"] == true) {
                                                    device_status = "关机";
                                                } else {
                                                    device_status = "开机";
                                                }
                                            }

                                            if (typeof (value["131088"]) != "number" && typeof (value["131088"]) != "boolean") {
                                                ele_mode = "error";
                                            } else {
                                                if (value["131088"] == 1) {
                                                    ele_mode = "UPS供电";
                                                } else if (value["131088"] == 2) {
                                                    ele_mode = "旁路供电";
                                                }
                                            }

                                            if (typeof (value["131091"]) == "number") {
                                                if (value["131091"] == 224) {
                                                    ele_status = "非充电非放电状态";
                                                } else if (value["131091"] == 225) {
                                                    ele_status = "浮充状态";
                                                } else if (value["131091"] == 226) {
                                                    ele_status = "均充状态";
                                                } else if (value["131091"] == 227) {
                                                    ele_status = "放电状态";
                                                }
                                            } else {
                                                ele_status = "error";
                                            }

                                            //蓄电池电压状态
                                            if (typeof (value["131095"]) == "number") {
                                                if (value["131095"] == 0) {
                                                    voltage_status = "正常";
                                                } else if (value["131095"] == 1) {
                                                    voltage_status = "低于下限";
                                                } else if (value["131095"] == 2) {
                                                    voltage_status = "高于上限";
                                                } else if (value["131095"] == 240) {
                                                    voltage_status = "故障";
                                                }
                                            } else {
                                                voltage_status = "error";
                                            }

                                            data[i]["131088"] = ele_mode;
                                            data[i]["131090"] = device_status;
                                            data[i]["131091"] = ele_status;
                                            data[i]["131095"] = voltage_status;

                                            $.each(more_float_arr2, function (n, val) {
                                                if (typeof (value[val]) == "number") {
                                                    data[i][val] = value[val].toFixed(2);
                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            });

                                            $.each(boole_arr2, function (n, val) { //n:key,val:元素属性
                                                if (value[val] == true) {
                                                    ii++;
                                                }
                                            });
                                            data[i]["numbersa"] = ii;

                                            if (that.$data.switch_status == 1) {
                                                that.fresh_data(131585, that.$data.switch_deviceid);
                                                that.fresh_more_data(131585, that.$data.switch_deviceid);
                                            }
                                        }
                                    });
                                    that.$data.upsAlarm = data;

                                },
                                error: function (realdata) {
                                }
                            });
                        }

                        if (res["12"] == undefined) { //判断发电机是否存在
                            that.$data.alternatorInfo = [];
                            that.$data.isAlternator = false;
                        } else {
                            that.$data.isAlternator = true;

                            let alternator_arr = new Array();

                            let alternator_arr1 = new Array(); //pluginid为786689
                            let alternator_arr2 = new Array(); //pluginid为786690

                            //发电机的名称位置赋值
                            that.$data.alternatorInfo = res["12"];
                            $.each(res['12'], function (n, value) {
                                alternator_arr.push(value.deviceid);
                                if (value.pluginid == 786689) {
                                    alternator_arr1.push(value.deviceid);
                                } else if (value.pluginid == 786690) {
                                    alternator_arr2.push(value.deviceid);
                                }
                            });

                            //将分类的数据赋予变量中,用于实时刷新数据中使用
                            that.$data.alternatorArr1 = alternator_arr1;
                            that.$data.alternatorArr2 = alternator_arr2;

                            //将包含发电机的deviceid数组赋值到什么alternator_arr中，以便获取当状态
                            that.$data.alternator_arr = alternator_arr;

                            $.ajax({
                                url: '../static/get_power_alternator.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let data = eval("(" + result + ")");

                                    $.each(data, function (i, value) { //i:deviceid,value:数据组
                                        //数组为空/数组中不含有该值，则返回 -1
                                        var index1 = $.inArray(parseInt(i), alternator_arr1);

                                        if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                            let ii = 0; //用于告警数的计数
                                            // let float_arr1 = show_alternator_float_param1();
                                            let more_float_arr1 = show_alternator_more_float_param1();
                                            let boole_arr1 = show_alternator_boole_param1();

                                            let gear_status; //档位状态
                                            if (value["786489"] == 0) {
                                                gear_status = "停机";
                                            } else if (value["786489"] == 1) {
                                                gear_status = "手动";
                                            } else if (value["786489"] == 2) {
                                                gear_status = "自动";
                                            } else if (value["786489"] == 3) {
                                                gear_status = "测试";
                                            } else {
                                                gear_status = "error";
                                            }
                                            data[i]["786489"] = gear_status;

                                            $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                                if (typeof (value[val]) == "number") {
                                                    if (val == 786443) {
                                                        if (value["786443"] == 20000) {
                                                            data[i]["786443"] = "-";
                                                        } else {
                                                            data[i]["786443"] = value["786443"].toFixed(2);
                                                        }
                                                    } else if (val == 786444) {
                                                        if (value["786444"] == 20000) {
                                                            data[i]["786444"] = "-";
                                                        } else {
                                                            data[i]["786444"] = value["786444"].toFixed(2);
                                                        }
                                                    } else if (val == 786445) {
                                                        if (value["786445"] == 20000) {
                                                            data[i]["786445"] = "-";
                                                        } else {
                                                            data[i]["786445"] = value["786445"].toFixed(2);
                                                        }
                                                    } else if (val == 786487) { //整型
                                                        data[i][val] = value[val];
                                                    } else {
                                                        data[i][val] = value[val].toFixed(2);
                                                    }

                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            });

                                            $.each(boole_arr1, function (n, val) {
                                                if (value[val] == true) {
                                                    ii++;
                                                }
                                            });
                                            data[i]["numbersa"] = ii;
                                        }

                                        if (that.$data.alternator_status == 1) {
                                            that.fresh_alternator_data(786689, that.$data.alternator_deviceid);
                                            that.fresh_alternator_more_data(786689, that.$data.alternator_deviceid);
                                        }

                                    });
                                    that.$data.alternatorAlarm = data;

                                },
                                error: function (realdata) {
                                }
                            });

                            /**
                             * 4.添加电机型号ajax请求
                             */
                            $.ajax({
                                url: '../static/get_power_alternator2.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let data = eval("(" + result + ")");

                                    $.each(data, function (i, value) { //i:deviceid,value:数据组
                                        //数组为空/数组中不含有该值，则返回 -1
                                        var index1 = $.inArray(parseInt(i), alternator_arr2);

                                        if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                            let ii = 0; //用于告警数的计数
                                            let more_float_arr1 = show_alternator_more_float_param1();
                                            let boole_arr1 = show_alternator_boole_param1();

                                            let gear_status; //档位状态
                                            if (value["786489"] == 0) {
                                                gear_status = "停机";
                                            } else if (value["786489"] == 1) {
                                                gear_status = "手动";
                                            } else if (value["786489"] == 2) {
                                                gear_status = "自动";
                                            } else if (value["786489"] == 3) {
                                                gear_status = "测试";
                                            } else {
                                                gear_status = "error";
                                            }
                                            data[i]["786489"] = gear_status;

                                            $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                                if (typeof (value[val]) == "number") {
                                                    if (val == 786443) {
                                                        if (value["786443"] == 20000) {
                                                            data[i]["786443"] = "-";
                                                        } else {
                                                            data[i]["786443"] = value["786443"].toFixed(2);
                                                        }
                                                    } else if (val == 786444) {
                                                        if (value["786444"] == 20000) {
                                                            data[i]["786444"] = "-";
                                                        } else {
                                                            data[i]["786444"] = value["786444"].toFixed(2);
                                                        }
                                                    } else if (val == 786445) {
                                                        if (value["786445"] == 20000) {
                                                            data[i]["786445"] = "-";
                                                        } else {
                                                            data[i]["786445"] = value["786445"].toFixed(2);
                                                        }
                                                    } else if (val == 786487) { //整型
                                                        data[i][val] = value[val];
                                                    } else {
                                                        data[i][val] = value[val].toFixed(2);
                                                    }

                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })
                                            let boole_arr2 = ["786448","786449",
                                                "786450","786451","786452","786453","786454",
                                                "786455","786456","786457","786458","786459",
                                                "786460","786461","786462","786463","786464",
                                                "786465","786466","786467","786468","786469",
                                                "786470","786471","786472","786473","786474",
                                                "786475","786476","786477","786478","786479",
                                                "786480","786481","786482","786483","786484",
                                                "786485","786486","786493"]
                                            $.each(boole_arr2, function (n, val) {
                                                if (value[val] == true) {
                                                    ii++;
                                                }
                                            })
                                            data[i]["numbersa"] = ii;
                                        }
                                        if (that.$data.alternator_status2 == 1) {
                                            that.fresh_alternator_data2(786690, that.$data.alternator_deviceid2);
                                            that.fresh_alternator_more_data2(786690, that.$data.alternator_deviceid2);
                                        }
                                    })
                                    that.$data.alternatorAlarm2 = data;

                                },
                                error: function (realdata) {
                                }
                            });

                        }

                        if (res["14"] == undefined) { //判断蓄电池传感器是否存在
                            that.$data.batterySonsorList = [];
                            that.$data.isBatterySensor = false;
                        } else {
                            that.$data.isBatterySensor = true;
                            let batterySencor_arr = new Array();
                            //that.$data.waters = res["1"];
                            $.each(res['14'], function (n, value) {
                                batterySencor_arr.push(value.deviceid);
                            })

                            //将包含市电的deviceid数组赋值到electric_arr中，以便获取当状态
                            that.$data.batterySencor_arr = batterySencor_arr;
                            let real_msg = {
                                "batterySonsorList": batterySencor_arr
                            };
                            $.ajax({
                                url: '../static/get_env_electricdata.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let realdata = eval("(" + result + ")");
                                    $.each(res["14"], function (i, value) {
                                        if (value["917504"] == true) {
                                            value["isActive"] = false;
                                            value["isnull"] = true;
                                            //value["brief"] = "采集超时";
                                        }
                                        res["14"][i] = value;
                                    })
                                    that.$data.batterySencor_arr = res["14"];
                                },
                                error: function (realdata) {
                                }
                            })
                        }

                        if (res["13"] == undefined) { //判断漏电模块是否存在
                            that.$data.leakageInfo = [];
                            that.$data.isLeakage = false;
                        } else {
                            that.$data.isLeakage = true;

                            let leakage_arr = new Array();

                            let leakage_arr1 = new Array(); //pluginid为852225
                            /*let alternator_arr2 = new Array();//pluginid为786690*/

                            //漏电模块的名称位置赋值
                            that.$data.leakageInfo = res["13"];
                            $.each(res['13'], function (n, value) {
                                leakage_arr.push(value.deviceid);
                            });

                            //将分类的数据赋予变量中,用于实时刷新数据中使用
                            that.$data.leakageArr = leakage_arr;

                            //将包含漏电模块的deviceid数组赋值到什么alternator_arr中，以便获取当状态
                            that.$data.leakage_arr = leakage_arr;

                            $.ajax({
                                url: '../static/get_power_leakage.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let data = eval("(" + result + ")");

                                    $.each(data, function (i, value) { //i:deviceid,value:数据组
                                        //数组为空/数组中不含有该值，则返回 -1
                                        var index1 = $.inArray(parseInt(i), leakage_arr1);

                                        if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                            let ii = 0; //用于告警数的计数
                                            // let float_arr1 = show_alternator_float_param1();
                                            let more_float_arr1 = show_leakage_more_float_param2();
                                            let float_arr1 = show_leakage_float_param1();

                                            $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                                if (typeof (value[val]) == "number") {
                                                    if (val == 786443) {
                                                        if (value["786443"] == 20000) {
                                                            data[i]["786443"] = "-";
                                                        } else {
                                                            data[i]["786443"] = value["786443"].toFixed(2);
                                                        }
                                                    } else if (val == 786444) {
                                                        if (value["786444"] == 20000) {
                                                            data[i]["786444"] = "-";
                                                        } else {
                                                            data[i]["786444"] = value["786444"].toFixed(2);
                                                        }
                                                    } else if (val == 786445) {
                                                        if (value["786445"] == 20000) {
                                                            data[i]["786445"] = "-";
                                                        } else {
                                                            data[i]["786445"] = value["786445"].toFixed(2);
                                                        }
                                                    } else if (val == 786487) { //整型
                                                        data[i][val] = value[val];
                                                    } else {
                                                        data[i][val] = value[val].toFixed(2);
                                                    }

                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            });

                                            $.each(boole_arr1, function (n, val) {
                                                if (value[val] == true) {
                                                    ii++;
                                                }
                                            });
                                            data[i]["numbersa"] = ii;
                                        }

                                        if (that.$data.leakage_status == 1) {
                                            that.fresh_leakage_data(852225, that.$data.leakage_deviceid);
                                            that.fresh_leakage_more_data(786689, that.$data.leakage_deviceid);
                                        }

                                    });
                                    that.$data.leakageAlarm = data;

                                },
                                error: function (realdata) {
                                }
                            });
                        }

                        if (res["15"] == undefined) { //判断电量检测器是否存在
                            that.$data.electricMonitorInfo = [];
                            that.$data.electricmonitorData = [];
                        } else {
                            let electricMonitor_arr = new Array();
                            let electricMonitor_arr1 = new Array(); //pluginid 为 ‭983297
                            let electricMonitor_arr2 = new Array(); //pluginid 为 ‭983298

                            //电量监测器名称位置赋值
                            that.$data.electricMonitorInfo = res["15"];
                            $.each(res['15'], function (n, value) {
                                electricMonitor_arr.push(value.deviceid);

                                if (value.pluginid == 983297) {
                                    electricMonitor_arr1.push(value.deviceid);
                                }

                                if (value.pluginid == 983298) {
                                    electricMonitor_arr2.push(value.deviceid);
                                }
                            });
                            //将分类变量数据赋予变量中，用于实时刷新
                            that.$data.electricMoitorAtrr1 = electricMonitor_arr1;
                            that.$data.electricMoitorAtrr2 = electricMonitor_arr2;
                            //将包含电量监测器的deviceid数组赋值到electricMonitor_arr中，以便于获取当前状态
                            that.$data.electricMonitor_arr = electricMonitor_arr;
                            //let real_msg ={"devicelist":electricMonitor_arr};
                            $.ajax({
                                url: '../static/get_env_electricMoitor.json',
                                type: 'GET',
                                cache: false,
                                async: false,
                                dataType: 'text',
                                success: function (result) {
                                    let data = eval("(" + result + ")");
                                    $.each(data, function (i, value) {
                                        var index1 = $.inArray(parseInt(i), electricMonitor_arr1);
                                        var index2 = $.inArray(parseInt(i), electricMonitor_arr2);
                                        if (index1 >= 0) { //属于插件pluginid为983297的传感器
                                            let more_float_arr1 = show_electricMonitor_more_float_param();

                                            $.each(more_float_arr1, function (n, val) {
                                                if (typeof (value[val]) == "number") {
                                                    data[i][val] = value[val].toFixed(2);
                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })
                                        }
                                        if (index2 >= 0) { //属于插件pluginid为的传感器
                                            let more_float_arr2 = show_electricMonitor_more_float_param();

                                            $.each(more_float_arr2, function (n, val) {
                                                if (typeof (value[val]) == "number") {
                                                    data[i][val] = value[val].toFixed(2);
                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })
                                        }
                                    });
                                    that.$data.electricMonitorAlarm = data;
                                },
                                error: function (realdata) {
                                }

                            });

                        }

                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                    }
                });

            } else { //调用main.cgi
                $.ajax({
                    url: "cgi-bin/main.cgi",
                    contentType: "application/json;charset=utf-8",
                    type: "post",
                    cache: false,
                    async: false,
                    data: JSON.stringify(get_env_msg),
                    success: function (msg) {
                        let res = eval("(" + msg + ")");
                        //判断是否存在某类传感器，需要判断数据是不是存在
                        if (res["6"] == undefined) { //判断市电是否存在
                            that.$data.electricList = [];
                            that.$data.isElectric = false;
                        } else {
                            that.$data.isElectric = true;
                            let electric_arr = new Array();
                            //that.$data.waters = res["1"];
                            $.each(res['6'], function (n, value) {
                                electric_arr.push(value.deviceid);
                            })

                            //将包含市电的deviceid数组赋值到什么electric_arr中，以便获取当状态
                            that.$data.electric_arr = electric_arr;
                            let real_msg = {
                                "devicelist": electric_arr
                            };

                            $.ajax({
                                url: 'cgi-bin/JHMonitoring.cgi',
                                type: 'post',
                                cache: false,
                                async: false,
                                data: JSON.stringify(real_msg),
                                success: function (result) {
                                    let realdata = eval("(" + result + ")");

                                    $.each(res["6"], function (i, value) {
                                        if (value["393216"] == true) {
                                            value["isActive"] = false;
                                            value["isnull"] = true;
                                            //value["brief"] = "采集超时";
                                        } else {
                                            if (realdata[value.deviceid]["393217"] == 1) { //告警
                                                value["isActive"] = true;
                                                //console.log("OK");
                                            } else { //不告警
                                                value["isActive"] = false;
                                                //console.log("ERROR");
                                            }
                                            value["isnull"] = false;
                                            //value["brief"] = "";
                                        }
                                        res["6"][i] = value;
                                    })
                                    that.$data.electricList = res["6"];
                                },
                                error: function (realdata) {
                                }
                            })
                        }


                        if (res["5"] == undefined) { //判断三相电是否存在
                            that.$data.threeInfo = [];
                            that.$data.threeData = [];
                            that.$data.isThree = false;
                        } else {
                            that.$data.isThree = true;
                            let three_arr = new Array();
                            let three_arr1 = new Array(); //pluginid 为 327937
                            let three_arr2 = new Array(); //pluginid 为 327938

                            //三相电的名称位置赋值
                            that.$data.threeInfo = res["5"];

                            $.each(res['5'], function (n, value) {
                                three_arr.push(value.deviceid);

                                if (value.pluginid == 327937) {
                                    three_arr1.push(value.deviceid);
                                }

                                if (value.pluginid == 327938) {
                                    three_arr2.push(value.deviceid);
                                }
                            })

                            //将分类的数据赋予变量中
                            that.$data.threeArr1 = three_arr1;
                            that.$data.threeArr2 = three_arr2;
                            //将包含三相电的deviceid数组赋值到什么three_arr中，以便获取当状态
                            that.$data.three_arr = three_arr;
                            //console.info(three_arr); //三相电传感器的devicelist
                            let real_msg = {
                                "devicelist": three_arr
                            };
                            $.ajax({
                                url: 'cgi-bin/JHMonitoring.cgi',
                                type: 'post',
                                cache: false,
                                async: false,
                                data: JSON.stringify(real_msg),
                                success: function (result) {
                                    let data = eval("(" + result + ")");
                                    $.each(data, function (i, value) {
                                        var index1 = $.inArray(parseInt(i), three_arr1);
                                        var index2 = $.inArray(parseInt(i), three_arr2);
                                        if (index1 >= 0) { //属于插件pluginid为327937的传感器
                                            let threedata_arr = new Array();
                                            let arr1 = new Array();
                                            let arr2 = new Array();
                                            let arr3 = new Array();

                                            if (value["327680"] == true) {
                                                arr1["name"] = "A相";
                                                arr1["voltage"] = "error";
                                                arr1["current"] = "error";
                                                arr2["name"] = "B相";
                                                arr2["voltage"] = "error";
                                                arr2["current"] = "error";
                                                arr3["name"] = "C相";
                                                arr3["voltage"] = "error";
                                                arr3["current"] = "error";
                                                //value["brief"] = "采集超时";
                                            } else {
                                                arr1["name"] = "A相";
                                                if (typeof (value["327681"]) == "number") {
                                                    arr1["voltage"] = value["327681"].toFixed(2);
                                                } else {
                                                    arr1["voltage"] = "error";
                                                }
                                                if (typeof (value["327684"]) == "number") {
                                                    arr1["current"] = value["327684"].toFixed(2);
                                                } else {
                                                    arr1["current"] = "error";
                                                }
                                                arr2["name"] = "B相";
                                                if (typeof (value["327682"]) == "number") {
                                                    arr2["voltage"] = value["327682"].toFixed(2);
                                                } else {
                                                    arr2["voltage"] = "error";
                                                }
                                                if (typeof (value["327685"]) == "number") {
                                                    arr2["current"] = value["327685"].toFixed(2);
                                                } else {
                                                    arr2["current"] = "error";
                                                }
                                                arr3["name"] = "C相";
                                                if (typeof (value["327683"]) == "number") {
                                                    arr3["voltage"] = value["327683"].toFixed(2);
                                                } else {
                                                    arr3["voltage"] = "error";
                                                }
                                                if (typeof (value["327686"]) == "number") {
                                                    arr3["current"] = value["327686"].toFixed(2);
                                                } else {
                                                    arr3["current"] = "error";
                                                }
                                            }
                                            threedata_arr[0] = arr1;
                                            threedata_arr[1] = arr2;
                                            threedata_arr[2] = arr3;

                                            that.$data.threeData[i] = threedata_arr;
                                        }

                                        if (index2 >= 0) { //属于插件pluginid为327938的传感器
                                            let threedata_arr = new Array();
                                            let arr1 = new Array();
                                            let arr2 = new Array();
                                            let arr3 = new Array();

                                            if (value["327680"] == true) {
                                                arr1["name"] = "AB线";
                                                arr1["voltage"] = "error";
                                                arr1["current"] = "error";
                                                arr2["name"] = "BC线";
                                                arr2["voltage"] = "error";
                                                arr2["current"] = "error";
                                                arr3["name"] = "CA线";
                                                arr3["voltage"] = "error";
                                                arr3["current"] = "error";
                                                //value["brief"] = "采集超时";
                                            } else {
                                                arr1["name"] = "AB线";
                                                if (typeof (value["327687"]) == "number") {
                                                    arr1["voltage"] = value["327687"].toFixed(2);
                                                } else {
                                                    arr1["voltage"] = "error";
                                                }
                                                if (typeof (value["327684"]) == "number") {
                                                    arr1["current"] = value["327684"].toFixed(2);
                                                } else {
                                                    arr1["current"] = "error";
                                                }

                                                arr2["name"] = "BC线";

                                                if (typeof (value["327688"]) == "number") {
                                                    arr2["voltage"] = value["327688"].toFixed(2);
                                                } else {
                                                    arr2["voltage"] = "error";
                                                }
                                                if (typeof (value["327685"]) == "number") {
                                                    arr2["current"] = value["327685"].toFixed(2);
                                                } else {
                                                    arr2["current"] = "error";
                                                }

                                                arr3["name"] = "CA线";
                                                if (typeof (value["327689"]) == "number") {
                                                    arr3["voltage"] = value["327689"].toFixed(2);
                                                } else {
                                                    arr3["voltage"] = "error";
                                                }
                                                if (typeof (value["327686"]) == "number") {
                                                    arr3["current"] = value["327686"].toFixed(2);
                                                } else {
                                                    arr3["current"] = "error";
                                                }
                                            }
                                            threedata_arr[0] = arr1;
                                            threedata_arr[1] = arr2;
                                            threedata_arr[2] = arr3;

                                            that.$data.threeData[i] = threedata_arr;
                                            let real_msg = {
                                                "devicelist": three_arr
                                            };
                                        }

                                    })


                                },
                                error: function (realdata) {
                                }
                            })
                        }

                        if (res["2"] == undefined) { //判断UPS是否存在
                            that.$data.UPSInfo = [];
                            that.$data.UPSData = [];
                            that.$data.isUPS = false;
                        } else {

                            that.$data.isUPS = true;
                            let ups_arr = new Array();

                            let ups_arr2 = new Array(); //pluginid 为 131585
                            //UPS的名称位置赋值
                            that.$data.UPSInfo = res["2"];
                            $.each(res['2'], function (n, value) {
                                ups_arr.push(value.deviceid);
                                if (value.pluginid == 131585) {
                                    ups_arr2.push(value.deviceid);
                                }
                            })

                            //将分类的数组赋予变量中,用于实时刷新数据中使用
                            that.$data.upsArr2 = ups_arr2;

                            //将包含三相电的deviceid数组赋值到什么ups_arr中，以便获取当状态
                            that.$data.ups_arr = ups_arr;
                            let real_msg = {
                                "devicelist": ups_arr
                            };

                            $.ajax({
                                url: 'cgi-bin/JHMonitoring.cgi',
                                type: 'post',
                                cache: false,
                                async: false,
                                data: JSON.stringify(real_msg),
                                success: function (result) {
                                    let data = eval("(" + result + ")");


                                    $.each(data, function (i, value) {

                                        var index2 = $.inArray(parseInt(i), ups_arr2);
                                        if (index2 >= 0) { //属于插件pluginid为131585的传感器
                                            let ii = 0;
                                            let ele_mode; //供电方式
                                            let device_status; //开机状态
                                            let ele_status; //电池充电状态
                                            let voltage_status; //蓄电池电压状态

                                            let more_float_arr2 = show_ups_more_float_param2();
                                            let boole_arr2 = show_ups_boole_param2();

                                            if (typeof (value["131090"]) != "number" && typeof (value["131090"]) != "boolean") {
                                                device_status = "error";
                                            } else {
                                                if (value["131090"] == true) {
                                                    device_status = "关机";
                                                } else {
                                                    device_status = "开机";
                                                }
                                            }

                                            if (typeof (value["131088"]) != "number" && typeof (value["131088"]) != "boolean") {
                                                ele_mode = "error";
                                            } else {
                                                if (value["131088"] == 1) {
                                                    ele_mode = "UPS供电";
                                                } else if (value["131088"] == 2) {
                                                    ele_mode = "旁路供电";
                                                }
                                            }

                                            if (typeof (value["131091"]) == "number") {
                                                if (value["131091"] == 224) {
                                                    ele_status = "非充电非放电状态";
                                                } else if (value["131091"] == 225) {
                                                    ele_status = "浮充状态";
                                                } else if (value["131091"] == 226) {
                                                    ele_status = "均充状态";
                                                } else if (value["131091"] == 227) {
                                                    ele_status = "放电状态";
                                                }
                                            } else {
                                                ele_status = "error";
                                            }

                                            //蓄电池电压状态
                                            if (typeof (value["131095"]) == "number") {
                                                if (value["131095"] == 0) {
                                                    voltage_status = "正常";
                                                } else if (value["131095"] == 1) {
                                                    voltage_status = "低于下限";
                                                } else if (value["131095"] == 2) {
                                                    voltage_status = "高于上限";
                                                } else if (value["131095"] == 240) {
                                                    voltage_status = "故障";
                                                }
                                            } else {
                                                voltage_status = "error";
                                            }

                                            data[i]["131088"] = ele_mode;
                                            data[i]["131090"] = device_status;
                                            data[i]["131091"] = ele_status;
                                            data[i]["131095"] = voltage_status;

                                            $.each(more_float_arr2, function (n, val) {
                                                if (typeof (value[val]) == "number") {
                                                    data[i][val] = value[val].toFixed(2);
                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })

                                            $.each(boole_arr2, function (n, val) { //n:key,val:元素属性
                                                if (value[val] == true) {
                                                    ii++;
                                                }
                                            })
                                            data[i]["numbersa"] = ii;

                                            if (that.$data.switch_status == 1) {
                                                that.fresh_data(131585, that.$data.switch_deviceid);
                                                that.fresh_more_data(131585, that.$data.switch_deviceid);
                                            }
                                        }
                                    })
                                    that.$data.upsAlarm = data;


                                },
                                error: function (realdata) {
                                }
                            })
                        }

                        if (res["12"] == undefined) { //判断发电机是否存在
                            that.$data.alternatorInfo = [];
                            that.$data.isAlternator = false;
                        } else {
                            that.$data.isAlternator = true;

                            let alternator_arr = new Array();

                            let alternator_arr1 = new Array(); //pluginid为786689
                            let alternator_arr2 = new Array(); //pluginid为786690

                            //发电机的名称位置赋值
                            that.$data.alternatorInfo = res["12"];
                            $.each(res['12'], function (n, value) {
                                alternator_arr.push(value.deviceid);
                                if (value.pluginid == 786689) {
                                    alternator_arr1.push(value.deviceid);
                                }
                                if (value.pluginid == 786690) {
                                    alternator_arr2.push(value.deviceid);
                                }
                            })
                            //将分类的数据赋予变量中,用于实时刷新数据中使用
                            that.$data.alternatorArr1 = alternator_arr1;
                            that.$data.alternatorArr2 = alternator_arr2;

                            //将包含发电机的deviceid数组赋值到什么alternator_arr中，以便获取当状态
                            that.$data.alternator_arr = alternator_arr;
                            let real_msg = {
                                "devicelist": alternator_arr
                            };

                            $.ajax({
                                url: 'cgi-bin/JHMonitoring.cgi',
                                type: 'post',
                                cache: false,
                                async: false,
                                data: JSON.stringify(real_msg),
                                success: function (result) {
                                    let data = eval("(" + result + ")");

                                    $.each(data, function (i, value) { //i:deviceid,value:数据组
                                        //数组为空/数组中不含有该值，则返回 -1

                                        var index1 = $.inArray(parseInt(i), alternator_arr1);

                                        if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                            let ii = 0; //用于告警数的计数
                                            let float_arr1 = show_alternator_float_param1();
                                            let more_float_arr1 = show_alternator_more_float_param1();
                                            let boole_arr1 = show_alternator_boole_param1();

                                            let gear_status; //档位状态
                                            if (value["786489"] == 0) {
                                                gear_status = "停机";
                                            } else if (value["786489"] == 1) {
                                                gear_status = "手动";
                                            } else if (value["786489"] == 2) {
                                                gear_status = "自动";
                                            } else if (value["786489"] == 3) {
                                                gear_status = "测试";
                                            } else {
                                                gear_status = "error";
                                            }
                                            data[i]["786489"] = gear_status;


                                            $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                                if (typeof (value[val]) == "number") {
                                                    if (val == 786443) {
                                                        if (value["786443"] == 20000) {
                                                            data[i]["786443"] = "-";
                                                        } else {
                                                            data[i]["786443"] = value["786443"].toFixed(2);
                                                        }
                                                    } else if (val == 786444) {
                                                        if (value["786444"] == 20000) {
                                                            data[i]["786444"] = "-";
                                                        } else {
                                                            data[i]["786444"] = value["786444"].toFixed(2);
                                                        }
                                                    } else if (val == 786445) {
                                                        if (value["786445"] == 20000) {
                                                            data[i]["786445"] = "-";
                                                        } else {
                                                            data[i]["786445"] = value["786445"].toFixed(2);
                                                        }
                                                    } else if (val == 786487) { //整型
                                                        data[i][val] = value[val];
                                                    } else {
                                                        data[i][val] = value[val].toFixed(2);
                                                    }

                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })

                                            $.each(boole_arr1, function (n, val) {
                                                if (value[val] == true) {
                                                    ii++;
                                                }
                                            })
                                            data[i]["numbersa"] = ii;
                                        }

                                        if (that.$data.alternator_status == 1) {
                                            that.fresh_alternator_data(786689, that.$data.alternator_deviceid);
                                            that.fresh_alternator_more_data(786689, that.$data.alternator_deviceid);
                                        }
                                        if (that.$data.alternator_status2 == 1) {
                                            that.fresh_alternator_data2(786690, that.$data.alternator_deviceid2);
                                            that.fresh_alternator_more_data2(786690, that.$data.alternator_deviceid2);
                                        }
                                    })
                                    that.$data.alternatorAlarm = data;
                                },
                                error: function (realdata) {
                                }
                            })
                        }

                        if (res["13"] == undefined) { //判断漏电模块是否存在
                            that.$data.leakageInfo = [];
                            that.$data.isLeakage = false;
                        } else {
                            that.$data.isLeakage = true;

                            let leakage_arr = new Array();

                            let leakage_arr1 = new Array(); //pluginid为852225
                            /*let alternator_arr2 = new Array();//pluginid为786690*/

                            //漏电模块的名称位置赋值
                            that.$data.leakageInfo = res["13"];
                            $.each(res['13'], function (n, value) {
                                leakage_arr.push(value.deviceid);
                            });

                            //将分类的数据赋予变量中,用于实时刷新数据中使用
                            that.$data.leakageArr = leakage_arr;

                            //将包含漏电模块的deviceid数组赋值到什么alternator_arr中，以便获取当状态
                            that.$data.leakage_arr = leakage_arr;
                            let real_msg = {
                                "devicelist": leakage_arr
                            };

                            $.ajax({
                                url: 'cgi-bin/JHMonitoring.cgi',
                                type: 'post',
                                cache: false,
                                async: false,
                                data: JSON.stringify(real_msg),
                                success: function (result) {
                                    let data = eval("(" + result + ")");

                                    $.each(data, function (i, value) { //i:deviceid,value:数据组
                                        //数组为空/数组中不含有该值，则返回 -1
                                        var index1 = $.inArray(parseInt(i), leakage_arr1);

                                        if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                            let ii = 0; //用于告警数的计数
                                            // let float_arr1 = show_alternator_float_param1();
                                            let more_float_arr1 = show_leakage_more_float_param2();
                                            let float_arr1 = show_leakage_float_param1();

                                            /*let gear_status;//档位状态
                        if(value["786489"] == 0){
                          gear_status = "停机";
                        }else if(value["786489"] == 1){
                          gear_status = "手动";
                        }else if(value["786489"] == 2){
                          gear_status = "自动";
                        }else if(value["786489"] == 3){
                          gear_status = "测试";
                        }else{
                          gear_status = "error";
                        }
                        data[i]["786489"] = gear_status;*/

                                            $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                                if (typeof (value[val]) == "number") {
                                                    if (val == 786443) {
                                                        if (value["786443"] == 20000) {
                                                            data[i]["786443"] = "-";
                                                        } else {
                                                            data[i]["786443"] = value["786443"].toFixed(2);
                                                        }
                                                    } else if (val == 786444) {
                                                        if (value["786444"] == 20000) {
                                                            data[i]["786444"] = "-";
                                                        } else {
                                                            data[i]["786444"] = value["786444"].toFixed(2);
                                                        }
                                                    } else if (val == 786445) {
                                                        if (value["786445"] == 20000) {
                                                            data[i]["786445"] = "-";
                                                        } else {
                                                            data[i]["786445"] = value["786445"].toFixed(2);
                                                        }
                                                    } else if (val == 786487) { //整型
                                                        data[i][val] = value[val];
                                                    } else {
                                                        data[i][val] = value[val].toFixed(2);
                                                    }

                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })

                                            $.each(boole_arr1, function (n, val) {
                                                if (value[val] == true) {
                                                    ii++;
                                                }
                                            })
                                            data[i]["numbersa"] = ii;
                                        }

                                        if (that.$data.leakage_status == 1) {
                                            that.fresh_leakage_data(852225, that.$data.leakage_deviceid);
                                            that.fresh_leakage_more_data(786689, that.$data.leakage_deviceid);
                                        }

                                    })
                                    that.$data.leakageAlarm = data;

                                },
                                error: function (realdata) {
                                }
                            });
                        }


                        if (res["14"] == undefined) { //判断蓄电池传感器是否存在
                            that.$data.batterySonsorList = [];
                            that.$data.isBatterySensor = false;
                        } else {
                            that.$data.isBatterySensor = true;
                            let batterySencor_arr = new Array();
                            //that.$data.waters = res["1"];
                            $.each(res['14'], function (n, value) {
                                batterySencor_arr.push(value.deviceid);
                            })

                            //将包含蓄电池传感器的deviceid数组赋值到electric_arr中，以便获取当状态
                            that.$data.batterySencor_arr = batterySencor_arr;
                            let real_msg = {
                                "batterySonsorList": batterySencor_arr
                            };
                            $.ajax({
                                url: 'cgi-bin/JHMonitoring.cgi',
                                type: 'POST',
                                cache: false,
                                async: false,
                                data: JSON.stringify(real_msg),
                                success: function (result) {
                                    let realdata = eval("(" + result + ")");
                                    $.each(res["14"], function (i, value) {
                                        if (value["917504"] == true) {
                                            value["isActive"] = false;
                                            value["isnull"] = true;
                                            //value["brief"] = "采集超时";
                                        }
                                        res["14"][i] = value;
                                    })
                                    that.$data.batterySencor_arr = res["14"];
                                },
                                error: function (realdata) {
                                }
                            })
                        }

                        if (res["15"] == undefined) { //判断电量检测器是否存在
                            that.$data.electricMonitorInfo = [];
                            that.$data.electricmonitorData = [];
                        } else {
                            let electricMonitor_arr = new Array();

                            let electricMonitor_arr1 = new Array(); //pluginid 为 ‭983297
                            let electricMonitor_arr2 = new Array(); //pluginid 为 ‭983298

                            //电量监测器名称位置赋值
                            that.$data.electricMonitorInfo = res["15"];
                            $.each(res['15'], function (n, value) {
                                electricMonitor_arr.push(value.deviceid);

                                if (value.pluginid == 983297) {
                                    electricMonitor_arr1.push(value.deviceid);
                                }

                                if (value.pluginid == 983298) {
                                    electricMonitor_arr2.push(value.deviceid);
                                }
                            })
                            //将分类变量数据赋予变量中
                            that.$data.electricMoitorAtrr1 = electricMonitor_arr1;
                            that.$data.electricMoitorAtrr2 = electricMonitor_arr2;
                            //将包含电量监测器的deviceid数组赋值到electricMonitor_arr中，以便于获取当前状态
                            that.$data.electricMonitor_arr = electricMonitor_arr;
                            let real_msg = {
                                "devicelist": electricMonitor_arr
                            };
                            //console.info(electricMonitor_arr);
                            $.ajax({
                                url: 'cgi-bin/JHMonitoring.cgi',
                                type: 'post',
                                cache: false,
                                async: false,
                                data: JSON.stringify(real_msg),
                                success: function (result) {
                                    let data = eval("(" + result + ")");
                                    $.each(data, function (i, value) {
                                        var index1 = $.inArray(parseInt(i), electricMonitor_arr1);
                                        var index2 = $.inArray(parseInt(i), electricMonitor_arr2);
                                        if (index1 >= 0) { //属于插件pluginid为983297的传感器
                                            let more_float_arr1 = show_electricMonitor_more_float_param();

                                            $.each(more_float_arr1, function (n, val) {
                                                if (typeof (value[val]) == "number") {
                                                    data[i][val] = value[val].toFixed(1);
                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })
                                        }
                                        if (index2 >= 0) { //属于插件pluginid为的传感器
                                            let more_float_arr2 = show_electricMonitor_more_float_param();

                                            $.each(more_float_arr2, function (n, val) {
                                                if (typeof (value[val]) == "number") {
                                                    data[i][val] = value[val].toFixed(1);
                                                } else {
                                                    data[i][val] = "error";
                                                }
                                            })
                                        }
                                    });
                                    that.$data.electricMonitorAlarm = data;
                                },
                                error: function (realdata) {
                                }

                            })

                        }


                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                    }
                });

            }

        },  //现在是不点击刷新按钮不执行
        batteryclick(deviceid) {
            this.$data.switch_deviceid = deviceid;
            this.$data.isShowRegDialog1 = true;
            this.$data.switch_status = 1;
        },
        alternatorSee(deviceid) {
            //alert(deviceid);
            this.$data.alternator_deviceid = deviceid;
            this.$data.alternatorDialog = true;
            this.$data.alternator_status = 1;
        },
        alternatorSee2(deviceid) {
            //console.info(deviceid);
            this.$data.alternator_deviceid2 = deviceid;
            this.$data.alternatorDialog2 = true;
            this.$data.alternator_status2 = 1;
        },
        fresh_data(pluginid, deviceid) {
            let data = this.$data.upsAlarm[deviceid];
            /*需知道ups拖动展示狂有几个选项，从选项中截取需要的ups告警信息弹窗第一行数据与第二行数据，（目前定于10条告警信息一行5个）*/

            if (pluginid == 131585) {
                //定义弹框中的两个数组,每6个数据为一组
                let arr21 = new Array();
                let arr22 = new Array();
                //获取该型号的boole数据
                let boole_arr2 = show_ups_boole_param2();
                $.each(boole_arr2, function (i, val) {
                    if (i <= 5) {
                        arr21.push(data[val]);
                    } else if (i > 5) {
                        arr22.push(data[val]);
                    }
                })
                if (this.$data.upsAlarm1.length > 0) {
                    this.$data.loading2 = false;
                } else {
                    this.$data.loading2 = true;
                }
                this.$data.upsAlarm1 = arr21;
                this.$data.upsAlarm2 = arr22;
            }
        },
        uspmore(deviceid) {
            this.$data.switch_deviceid = deviceid;
            //this.fresh_more_data(deviceid);
            this.$data.isShowRegDialog3 = true;
            this.$data.switch_status = 1;
        },
        fresh_more_data(pluginid, deviceid) {
            let data = this.$data.upsAlarm[deviceid];
            if (pluginid == 131585) {
                let arr21 = new Array();
                let more_float_arr2 = show_ups_more_float_param2();
                $.each(more_float_arr2, function (i, val) {
                    arr21.push(Number(data[val]).toFixed(2));
                });
                this.$data.moreupper = arr21;
            }
        },
        alternatormore(deviceid) {
            this.$data.alternator_deviceid = deviceid;
            //this.fresh_alternator_more_data(deviceid);
            this.$data.alternatorDialog13 = true;
            this.$data.alternator_status = 1;
        },
        leakagemore(deviceid) {
            this.$data.leakage_deviceid = deviceid;
            //this.fresh_alternator_more_data(deviceid);
            this.$data.leakageDialog13 = true;
            this.$data.leakage_status = 1;
        },
        alternatormore2(deviceid) {
            this.$data.alternator_deviceid2 = deviceid;
            //this.fresh_alternator_more_data(deviceid);
            this.$data.alternatorDialog132 = true;
            this.$data.alternator_status2 = 1;
        },
        fresh_alternator_data(pluginid, deviceid) {
            let data = 0;
            if (pluginid == 786689)
                data = this.$data.alternatorAlarm[deviceid];
            else
                data = this.$data.alternatorAlarm2[deviceid];
            /*需知道发电机拖动展示框有几个选项，从选项中截取需要的发电机告警信息弹窗第一行数据与第二行数据，（目前定于40条告警信息一行8个）*/

            if (pluginid == 786689) {
                //定义弹框中的5个数组,每8个数据为一组
                let arr11 = new Array();
                let arr12 = new Array();
                let arr13 = new Array();
                let arr14 = new Array();
                let arr15 = new Array();

                let boole_arr1 = show_alternator_boole_param1();
                $.each(boole_arr1, function (i, val) {
                    if (i <= 7) {
                        arr11.push(data[val]);
                    } else if (i > 7 && i <= 15) {
                        arr12.push(data[val]);
                    } else if (i > 15 && i <= 23) {
                        arr13.push(data[val]);
                    } else if (i > 23 && i <= 31) {
                        arr14.push(data[val]);
                    } else if (i > 31) {
                        arr15.push(data[val]);
                    }
                })

                if (this.$data.alternatorAlarm11.length > 0) {
                    this.$data.loading12 = false;
                } else {
                    this.$data.loading12 = true;
                }

                this.$data.alternatorAlarm11 = arr11;
                this.$data.alternatorAlarm12 = arr12;
                this.$data.alternatorAlarm13 = arr13;
                this.$data.alternatorAlarm14 = arr14;
                this.$data.alternatorAlarm15 = arr15;
            }

        },

        electricMonitormore(deviceid) {
            this.$data.electricMonitor_deviceid = deviceid;
            this.$data.electricMitorlog13 = true;
            this.$data.electricMonitor_status = 1;
        },
        electricMonitormore2(deviceid) {
            this.$data.electricMonitor_deviceid2 = deviceid;
            this.$data.electricMitorlog132 = true;
            this.$data.electricMonitor_status2 = 1;
        },
        leakagemore(deviceid) {
            this.$data.leakage_deviceid = deviceid;
            //this.fresh_alternator_more_data(deviceid);
            this.$data.leakageDialog13 = true;
            this.$data.leakage_status = 1;
        },

        fresh_alternator_data2(pluginid, deviceid) {
            let data = this.$data.alternatorAlarm2[deviceid];
            /*需知道发电机拖动展示框有几个选项，从选项中截取需要的发电机告警信息弹窗第一行数据与第二行数据，（目前定于40条告警信息一行8个）*/

            if (pluginid == 786690) {
                //定义弹框中的5个数组,每8个数据为一组
                let arr11 = new Array();
                let arr12 = new Array();
                let arr13 = new Array();

                /*let boole_arr1 = show_alternator_boole_param1();*/
                let boole_arr2 = show_alternator_boole_param2();
                $.each(boole_arr2, function (i, val) {
                    if (i <= 7) {
                        arr11.push(data[val]);
                    } else if (i > 7 && i <= 15) {
                        arr12.push(data[val]);
                    } else if (i > 15 && i <= 19) {
                        arr13.push(data[val]);
                    }
                });

                if (this.$data.alternatorAlarm11.length > 0) {
                    this.$data.loading12 = false;
                } else {
                    this.$data.loading12 = true;
                }

                this.$data.alternatorAlarm11 = arr11;
                this.$data.alternatorAlarm12 = arr12;
                this.$data.alternatorAlarm13 = arr13;
            }

        },
        fresh_alternator_more_data(pluginid, deviceid) { //根据插件ID,分类处理数据
            let data = this.$data.alternatorAlarm[deviceid];

            if (pluginid == 786689) {
                //定义弹框中的三个数组,每5个数据为一组
                let arr11 = new Array();
                let arr12 = new Array();
                let arr13 = new Array();
                let arr14 = new Array();

                let more_float_arr1 = show_alternator_more_float_param1();
                $.each(more_float_arr1, function (i, val) {
                    if (i <= 4) {
                        if (val == 786487) { //整型
                            arr11.push(Number(data[val]));
                        } else {
                            arr11.push(Number(data[val]).toFixed(2));
                        }
                    } else if (i > 4 && i <= 9) {

                        if (val == 786443) {
                            if (data[val] == "-") {
                                arr12.push("-");
                            } else {
                                arr12.push(Number(data[val]).toFixed(2));
                            }
                        } else {
                            arr12.push(Number(data[val]).toFixed(2));
                        }
                    } else if (i > 9 && i <= 14) {
                        arr13.push(Number(data[val]).toFixed(2));
                    } else if (i > 14) {
                        if (val == 786444) {
                            if (data[val] == "-") {
                                arr14.push("-");
                            } else {
                                arr14.push(Number(data[val]).toFixed(2));
                            }
                        } else if (val == 786445) {
                            if (data[val] == "-") {
                                arr14.push("-");
                            } else {
                                arr14.push(Number(data[val]).toFixed(2));
                            }
                        }
                    }
                });

                this.$data.morealternator = arr11;
                this.$data.morealternators = arr12;
                this.$data.morealternatorss = arr13;
                this.$data.morealternatorsss = arr14;

            }
        },
        fresh_alternator_more_data2(pluginid, deviceid) { //根据插件ID,分类处理数据
            let data = this.$data.alternatorAlarm2[deviceid];

            if (pluginid == 786690) {
                //定义弹框中的三个数组,每5个数据为一组
                let arr11 = new Array();
                let arr12 = new Array();
                let arr13 = new Array();
                let arr14 = new Array();

                let more_float_arr2 = show_alternator_more_float_param2();
                //console.info(more_float_arr2);
                $.each(more_float_arr2, function (i, val) {
                    if (i <= 4) {
                        if (val == 786487) { //整型
                            arr11.push(Number(data[val]));
                        } else {
                            arr11.push(Number(data[val]).toFixed(2));
                        }
                    } else if (i > 4 && i <= 9) {

                        if (val == 786443) {
                            if (data[val] == "-") {
                                arr12.push("-");
                            } else {
                                arr12.push(Number(data[val]).toFixed(2));
                            }
                        } else {
                            arr12.push(Number(data[val]).toFixed(2));
                        }
                    } else if (i > 9 && i <= 14) {
                        arr13.push(Number(data[val]).toFixed(2));
                    } else if (i > 14) {
                        if (val == 786444) {
                            if (data[val] == "-") {
                                arr14.push("-");
                            } else {
                                arr14.push(Number(data[val]).toFixed(2));
                            }
                        } else if (val == 786445) {
                            if (data[val] == "-") {
                                arr14.push("-");
                            } else {
                                arr14.push(Number(data[val]).toFixed(2));
                            }
                        } else {
                            arr14.push(Number(data[val]).toFixed(2));
                        }
                    }
                });

                //console.log(arr14);
                this.$data.morealternator2 = arr11;
                this.$data.morealternators2 = arr12;
                this.$data.morealternatorss2 = arr13;
                this.$data.morealternatorsss2 = arr14;

            }
        },

        fresh_leakage_data(pluginid, deviceid) {
            let data = 0;
            if (pluginid == 786689)
                data = this.$data.leakageAlarm[deviceid];
            else
                data = this.$data.leakageAlarm2[deviceid];
            /*需知道漏电模块拖动展示框有几个选项，从选项中截取需要的发电机告警信息弹窗第一行数据与第二行数据，（目前定于40条告警信息一行8个）*/

            if (pluginid == 852225) {
                //定义弹框中的5个数组,每8个数据为一组
                let arr11 = new Array();
                let arr12 = new Array();
                let arr13 = new Array();
                let arr14 = new Array();
                let arr15 = new Array();

                let float_arr1 = show_leakage_float_param1();
                $.each(float_arr1, function (i, val) {
                    if (i <= 7) {
                        arr11.push(data[val]);
                    } else if (i > 7 && i <= 15) {
                        arr12.push(data[val]);
                    } else if (i > 15 && i <= 23) {
                        arr13.push(data[val]);
                    } else if (i > 23 && i <= 31) {
                        arr14.push(data[val]);
                    } else if (i > 31) {
                        arr15.push(data[val]);
                    }
                })

                if (this.$data.leakageAlarm11.length > 0) {
                    this.$data.loading12 = false;
                } else {
                    this.$data.loading12 = true;
                }

                this.$data.leakageAlarm11 = arr11;
                this.$data.leakageAlarm12 = arr12;
                this.$data.leakageAlarm13 = arr13;
                this.$data.leakageAlarm14 = arr14;
                this.$data.leakageAlarm15 = arr15;
            }

        },

        get_three_info() { //获取三相电的实时数据
            let that = this;
            let three_arr1 = this.$data.threeArr1;
            let three_arr2 = this.$data.threeArr2;


            let real_msg = {
                "devicelist": this.$data.three_arr
            };

            if (window.sessionStorage.getItem('username') == "zyl") {
                $.ajax({
                    url: '../static/get_env_real_threedata.json',
                    type: 'GET',
                    cache: false,
                    async: false,
                    dataType: 'text',
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");
                        $.each(data, function (i, value) {

                            var index1 = $.inArray(parseInt(i), three_arr1);
                            var index2 = $.inArray(parseInt(i), three_arr2);


                            if (index1 >= 0) { //属于插件pluginid为327937的传感器
                                let threedata_arr = new Array();
                                let arr1 = new Array();
                                let arr2 = new Array();
                                let arr3 = new Array();

                                if (value["327680"] == true) {
                                    arr1["name"] = "A相";
                                    arr1["voltage"] = "error";
                                    arr1["current"] = "error";
                                    arr2["name"] = "B相";
                                    arr2["voltage"] = "error";
                                    arr2["current"] = "error";
                                    arr3["name"] = "C相";
                                    arr3["voltage"] = "error";
                                    arr3["current"] = "error";
                                    //value["brief"] = "采集超时";
                                } else {
                                    arr1["name"] = "A相";
                                    if (typeof (value["327681"]) == "number") {
                                        arr1["voltage"] = value["327681"].toFixed(2);
                                    } else {
                                        arr1["voltage"] = "error";
                                    }
                                    if (typeof (value["327684"]) == "number") {
                                        arr1["current"] = value["327684"].toFixed(2);
                                    } else {
                                        arr1["current"] = "error";
                                    }
                                    arr2["name"] = "B相";
                                    if (typeof (value["327682"]) == "number") {
                                        arr2["voltage"] = value["327682"].toFixed(2);
                                    } else {
                                        arr2["voltage"] = "error";
                                    }
                                    if (typeof (value["327685"]) == "number") {
                                        arr2["current"] = value["327685"].toFixed(2);
                                    } else {
                                        arr2["current"] = "error";
                                    }
                                    arr3["name"] = "C相";
                                    if (typeof (value["327683"]) == "number") {
                                        arr3["voltage"] = value["327683"].toFixed(2);
                                    } else {
                                        arr3["voltage"] = "error";
                                    }
                                    if (typeof (value["327686"]) == "number") {
                                        arr3["current"] = value["327686"].toFixed(2);
                                    } else {
                                        arr3["current"] = "error";
                                    }
                                }
                                threedata_arr[0] = arr1;
                                threedata_arr[1] = arr2;
                                threedata_arr[2] = arr3;
                                that.$data.threeData[i] = threedata_arr;
                                that.$set(that.$data.threeData,"0",threedata_arr);
                            }

                            if (index2 >= 0) { //属于插件pluginid为327938的传感器
                                let threedata_arr = new Array();
                                let arr1 = new Array();
                                let arr2 = new Array();
                                let arr3 = new Array();


                                if (value["327680"] == true) {
                                    arr1["name"] = "AB线";
                                    arr1["voltage"] = "error";
                                    arr1["current"] = "error";
                                    arr2["name"] = "BC线";
                                    arr2["voltage"] = "error";
                                    arr2["current"] = "error";
                                    arr3["name"] = "CA线";
                                    arr3["voltage"] = "error";
                                    arr3["current"] = "error";
                                    //value["brief"] = "采集超时";
                                } else {
                                    arr1["name"] = "AB线";
                                    if (typeof (value["327687"]) == "number") {
                                        arr1["voltage"] = value["327687"].toFixed(2);
                                    } else {
                                        arr1["voltage"] = "error";
                                    }
                                    if (typeof (value["327684"]) == "number") {
                                        arr1["current"] = value["327684"].toFixed(2);
                                    } else {
                                        arr1["current"] = "error";
                                    }

                                    arr2["name"] = "BC线";

                                    if (typeof (value["327688"]) == "number") {
                                        arr2["voltage"] = value["327688"].toFixed(2);
                                    } else {
                                        arr2["voltage"] = "error";
                                    }
                                    if (typeof (value["327685"]) == "number") {
                                        arr2["current"] = value["327685"].toFixed(2);
                                    } else {
                                        arr2["current"] = "error";
                                    }

                                    arr3["name"] = "CA线";
                                    if (typeof (value["327689"]) == "number") {
                                        arr3["voltage"] = value["327689"].toFixed(2);
                                    } else {
                                        arr3["voltage"] = "error";
                                    }
                                    if (typeof (value["327686"]) == "number") {
                                        arr3["current"] = value["327686"].toFixed(2);
                                    } else {
                                        arr3["current"] = "error";
                                    }
                                }
                                threedata_arr[0] = arr1;
                                threedata_arr[1] = arr2;
                                threedata_arr[2] = arr3;

                                that.$data.threeData[i] = threedata_arr;
                                that.$set(that.$data.threeData,"0",threedata_arr);
                            }

                        })
                    },
                    error: function (realdata) {
                    }
                })
            } else {
                $.ajax({
                    url: 'cgi-bin/JHMonitoring.cgi',
                    type: 'post',
                    cache: false,
                    async: false,
                    datatype: "JSON",
                    data: JSON.stringify(real_msg),
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");
                        $.each(data, function (i, value) {

                            var index1 = $.inArray(parseInt(i), three_arr1);
                            var index2 = $.inArray(parseInt(i), three_arr2);


                            if (index1 >= 0) { //属于插件pluginid为327937的传感器
                                let threedata_arr = new Array();
                                let arr1 = new Array();
                                let arr2 = new Array();
                                let arr3 = new Array();

                                if (value["327680"] == true) {
                                    arr1["name"] = "A相";
                                    arr1["voltage"] = "error";
                                    arr1["current"] = "error";
                                    arr2["name"] = "B相";
                                    arr2["voltage"] = "error";
                                    arr2["current"] = "error";
                                    arr3["name"] = "C相";
                                    arr3["voltage"] = "error";
                                    arr3["current"] = "error";
                                    //value["brief"] = "采集超时";
                                } else {
                                    arr1["name"] = "A相";
                                    if (typeof (value["327681"]) == "number") {
                                        arr1["voltage"] = value["327681"].toFixed(2);
                                    } else {
                                        arr1["voltage"] = "error";
                                    }
                                    if (typeof (value["327684"]) == "number") {
                                        arr1["current"] = value["327684"].toFixed(2);
                                    } else {
                                        arr1["current"] = "error";
                                    }
                                    arr2["name"] = "B相";
                                    if (typeof (value["327682"]) == "number") {
                                        arr2["voltage"] = value["327682"].toFixed(2);
                                    } else {
                                        arr2["voltage"] = "error";
                                    }
                                    if (typeof (value["327685"]) == "number") {
                                        arr2["current"] = value["327685"].toFixed(2);
                                    } else {
                                        arr2["current"] = "error";
                                    }
                                    arr3["name"] = "C相";
                                    if (typeof (value["327683"]) == "number") {
                                        arr3["voltage"] = value["327683"].toFixed(2);
                                    } else {
                                        arr3["voltage"] = "error";
                                    }
                                    if (typeof (value["327686"]) == "number") {
                                        arr3["current"] = value["327686"].toFixed(2);
                                    } else {
                                        arr3["current"] = "error";
                                    }
                                }
                                threedata_arr[0] = arr1;
                                threedata_arr[1] = arr2;
                                threedata_arr[2] = arr3;
                                that.$data.threeData[i] = threedata_arr;
                                that.$set(that.$data.threeData,"0",threedata_arr);
                            }

                            if (index2 >= 0) { //属于插件pluginid为327938的传感器
                                let threedata_arr = new Array();
                                let arr1 = new Array();
                                let arr2 = new Array();
                                let arr3 = new Array();


                                if (value["327680"] == true) {
                                    arr1["name"] = "AB线";
                                    arr1["voltage"] = "error";
                                    arr1["current"] = "error";
                                    arr2["name"] = "BC线";
                                    arr2["voltage"] = "error";
                                    arr2["current"] = "error";
                                    arr3["name"] = "CA线";
                                    arr3["voltage"] = "error";
                                    arr3["current"] = "error";
                                    //value["brief"] = "采集超时";
                                } else {
                                    arr1["name"] = "AB线";
                                    if (typeof (value["327687"]) == "number") {
                                        arr1["voltage"] = value["327687"].toFixed(2);
                                    } else {
                                        arr1["voltage"] = "error";
                                    }
                                    if (typeof (value["327684"]) == "number") {
                                        arr1["current"] = value["327684"].toFixed(2);
                                    } else {
                                        arr1["current"] = "error";
                                    }

                                    arr2["name"] = "BC线";

                                    if (typeof (value["327688"]) == "number") {
                                        arr2["voltage"] = value["327688"].toFixed(2);
                                    } else {
                                        arr2["voltage"] = "error";
                                    }
                                    if (typeof (value["327685"]) == "number") {
                                        arr2["current"] = value["327685"].toFixed(2);
                                    } else {
                                        arr2["current"] = "error";
                                    }

                                    arr3["name"] = "CA线";
                                    if (typeof (value["327689"]) == "number") {
                                        arr3["voltage"] = value["327689"].toFixed(2);
                                    } else {
                                        arr3["voltage"] = "error";
                                    }
                                    if (typeof (value["327686"]) == "number") {
                                        arr3["current"] = value["327686"].toFixed(2);
                                    } else {
                                        arr3["current"] = "error";
                                    }
                                }
                                threedata_arr[0] = arr1;
                                threedata_arr[1] = arr2;
                                threedata_arr[2] = arr3;

                                that.$data.threeData[i] = threedata_arr;
                                that.$set(that.$data.threeData,"0",threedata_arr);
                            }

                        })
                    },
                    error: function (realdata) {
                    }
                });
            }


        },
        get_ups_info() { //获取ups的实时数据
            let that = this;
            let ups_arr2 = this.$data.upsArr2;
            let real_msg = {
                "devicelist": this.$data.ups_arr
            };

            if (window.sessionStorage.getItem('username') == "zyl") {
                $.ajax({
                    url: '../static/get_env_real_upsdata.json',
                    type: 'GET',
                    cache: false,
                    async: false,
                    dataType: 'text',
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");
                        $.each(data, function (i, value) {
                            var index2 = $.inArray(parseInt(i), ups_arr2);
                            if (index2 >= 0) { //属于插件pluginid为131585的传感器
                                let ii = 0;
                                let ele_mode; //供电方式
                                let device_status; //开机状态
                                let ele_status; //电池充电状态
                                let voltage_status; //蓄电池电压状态

                                let more_float_arr2 = show_ups_more_float_param2();
                                let boole_arr2 = show_ups_boole_param2();


                                if (value["131090"] == true) {
                                    device_status = "关机";
                                } else {
                                    device_status = "开机";
                                }

                                if (value["131088"] == 1) {
                                    ele_mode = "UPS供电";
                                } else if (value["131088"] == 2) {
                                    ele_mode = "旁路供电";
                                }

                                if (value["131091"] == 224) {
                                    ele_status = "非充电非放电状态";
                                } else if (value["131091"] == 225) {
                                    ele_status = "浮充状态";
                                } else if (value["131091"] == 226) {
                                    ele_status = "均充状态";
                                } else if (value["131091"] == 227) {
                                    ele_status = "放电状态";
                                }

                                //蓄电池电压状态
                                if (value["131095"] == 0) {
                                    voltage_status = "正常";
                                } else if (value["131095"] == 1) {
                                    voltage_status = "低于下限";
                                } else if (value["131095"] == 2) {
                                    voltage_status = "高于上限";
                                } else if (value["131095"] == 240) {
                                    voltage_status = "故障";
                                }


                                data[i]["131088"] = ele_mode;
                                data[i]["131090"] = device_status;
                                data[i]["131091"] = ele_status;
                                data[i]["131095"] = voltage_status;

                                $.each(more_float_arr2, function (n, val) {
                                    if (typeof (value[val]) == "number") {
                                        data[i][val] = value[val].toFixed(2);
                                    } else {
                                        data[i][val] = "error";
                                    }
                                })

                                $.each(boole_arr2, function (n, val) { //n:key,val:元素属性
                                    if (value[val] == true) {
                                        ii++;
                                    }
                                })
                                data[i]["numbersa"] = ii;

                                if (that.$data.switch_status == 1) {
                                    that.fresh_data(131585, that.$data.switch_deviceid);
                                    that.fresh_more_data(131585, that.$data.switch_deviceid);
                                }
                            }
                        })
                        that.$data.upsAlarm = data;
                    },
                    error: function (realdata) {
                    }
                })
            } else {

                $.ajax({
                    url: 'cgi-bin/JHMonitoring.cgi',
                    type: 'post',
                    cache: false,
                    async: false,
                    data: JSON.stringify(real_msg),
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");
                        $.each(data, function (i, value) {
                            var index2 = $.inArray(parseInt(i), ups_arr2);
                            if (index2 >= 0) { //属于插件pluginid为131585的传感器
                                let ii = 0;
                                let ele_mode; //供电方式
                                let device_status; //开机状态
                                let ele_status; //电池充电状态
                                let voltage_status; //蓄电池电压状态

                                let more_float_arr2 = show_ups_more_float_param2();
                                let boole_arr2 = show_ups_boole_param2();

                                if (value["131090"] == true) {
                                    device_status = "关机";
                                } else {
                                    device_status = "开机";
                                }

                                if (value["131088"] == 1) {
                                    ele_mode = "UPS供电";
                                } else if (value["131088"] == 2) {
                                    ele_mode = "旁路供电";
                                }

                                if (value["131091"] == 224) {
                                    ele_status = "非充电非放电状态";
                                } else if (value["131091"] == 225) {
                                    ele_status = "浮充状态";
                                } else if (value["131091"] == 226) {
                                    ele_status = "均充状态";
                                } else if (value["131091"] == 227) {
                                    ele_status = "放电状态";
                                }

                                //蓄电池电压状态
                                if (value["131095"] == 0) {
                                    voltage_status = "正常";
                                } else if (value["131095"] == 1) {
                                    voltage_status = "低于下限";
                                } else if (value["131095"] == 2) {
                                    voltage_status = "高于上限";
                                } else if (value["131095"] == 240) {
                                    voltage_status = "故障";
                                }

                                data[i]["131088"] = ele_mode;
                                data[i]["131090"] = device_status;
                                data[i]["131091"] = ele_status;
                                data[i]["131095"] = voltage_status;

                                $.each(more_float_arr2, function (n, val) {
                                    if (typeof (value[val]) == "number") {
                                        data[i][val] = value[val].toFixed(2);
                                    } else {
                                        data[i][val] = "error";
                                    }
                                })

                                $.each(boole_arr2, function (n, val) { //n:key,val:元素属性
                                    if (value[val] == true) {
                                        ii++;
                                    }
                                })
                                data[i]["numbersa"] = ii;

                                if (that.$data.switch_status == 1) {
                                    that.fresh_data(131585, that.$data.switch_deviceid);
                                    that.fresh_more_data(131585, that.$data.switch_deviceid);
                                }
                            }
                        })
                        that.$data.upsAlarm = data;

                    },
                    error: function (realdata) {
                    }
                })
            }
        },
        get_electric_info() { //获取市电的实时状态
            let that = this;
            let ii = 0; //用于市电的计数
            let real_msg = {
                "devicelist": this.$data.electric_arr
            };
            if (window.sessionStorage.getItem('username') == "zyl") {
                $.ajax({
                    url: '../static/get_env_real_electricdata.json',
                    type: 'GET',
                    cache: false,
                    async: false,
                    dataType: 'text',
                    success: function (result) {
                        let data = eval("(" + result + ")");
                        $.each(data, function (i, value) {
                            if (value["393217"] == undefined) {
                                that.$data.electricList[ii]["isActive"] = false;
                                that.$data.electricList[ii]["isnull"] = true;
                                //value["brief"] = "采集超时";
                                ii++;
                            } else {
                                if (data[i]["393217"] == 1) { //告警
                                    that.$data.electricList[ii]["isActive"] = true;
                                } else { //不告警
                                    that.$data.electricList[ii]["isActive"] = false;
                                }
                                that.$data.electricList[ii]["isnull"] = false;
                                //value["brief"] = "";
                                ii++;
                            }
                        })
                    },
                    error: function (realdata) {
                    }
                })


            } else {
                $.ajax({
                    url: 'cgi-bin/JHMonitoring.cgi',
                    type: 'post',
                    cache: false,
                    async: false,
                    data: JSON.stringify(real_msg),
                    success: function (result) {
                        let data = eval("(" + result + ")");
                        $.each(data, function (i, value) {
                            if (value["393217"] == undefined) {
                                that.$data.electricList[ii]["isActive"] = false;
                                that.$data.electricList[ii]["isnull"] = true;
                                //value["brief"] = "采集超时";
                                ii++;
                            } else {
                                if (data[i]["393217"] == 1) { //告警
                                    that.$data.electricList[ii]["isActive"] = true;
                                } else { //不告警
                                    that.$data.electricList[ii]["isActive"] = false;
                                }
                                that.$data.electricList[ii]["isnull"] = false;
                                //value["brief"] = "";
                                ii++;
                            }
                        })
                    },
                    error: function (realdata) {
                    }
                })
            }
        },
        get_alternator_info() { //获取发电机的实时数据
            let that = this;
            let alternator_arr1 = this.$data.alternatorArr1;
            let alternator_arr2 = this.$data.alternatorArr2;
            let real_msg = {
                "devicelist": this.$data.alternator_arr
            };

            if (window.sessionStorage.getItem('username') == "zyl") {
                $.ajax({
                    url: '../static/get_power_real_alternator.json',
                    type: 'GET',
                    cache: false,
                    async: false,
                    dataType: 'text',
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");

                        let float_arr1 = show_alternator_float_param1();
                        let more_float_arr1 = show_alternator_more_float_param1();
                        let more_float_arr2 = show_alternator_more_float_param2();
                        let boole_arr1 = show_alternator_boole_param1();
                        let boole_arr2 = show_alternator_boole_param2();

                        $.each(data, function (i, value) {
                            //i:deviceid,value:数据组
                            //数组为空/数组中不含有该值，则返回 -1
                            var index1 = $.inArray(parseInt(i), alternator_arr1);
                            var index2 = $.inArray(parseInt(i), alternator_arr2);
                            if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                let ii = 0; //用于告警数的计数


                                let gear_status; //档位状态
                                if (value["786489"] == 0) {
                                    gear_status = "停机";
                                } else if (value["786489"] == 1) {
                                    gear_status = "手动";
                                } else if (value["786489"] == 2) {
                                    gear_status = "自动";
                                } else if (value["786489"] == 3) {
                                    gear_status = "测试";
                                } else {
                                    gear_status = "error";
                                }
                                data[i]["786489"] = gear_status;


                                $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786443) {
                                            if (value["786443"] == 20000) {
                                                data[i]["786443"] = "-";
                                            } else {
                                                data[i]["786443"] = value["786443"].toFixed(2);
                                            }
                                        } else if (val == 786444) {
                                            if (value["786444"] == 20000) {
                                                data[i]["786444"] = "-";
                                            } else {
                                                data[i]["786444"] = value["786444"].toFixed(2);
                                            }
                                        } else if (val == 786445) {
                                            if (value["786445"] == 20000) {
                                                data[i]["786445"] = "-";
                                            } else {
                                                data[i]["786445"] = value["786445"].toFixed(2);
                                            }
                                        } else if (val == 786487) { //整型
                                            data[i][val] = value[val];
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }

                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr1, function (n, val) {
                                    if (value[val] == true) {
                                        ii++;
                                    }
                                });
                                data[i]["numbersa"] = ii;
                                if (that.$data.alternator_status == 1) {
                                    that.fresh_alternator_data(786689, that.$data.alternator_deviceid);
                                    that.fresh_alternator_more_data(786689, that.$data.alternator_deviceid);
                                }
                                that.$data.alternatorAlarm = data;
                            }

                            if (index2 >= 0) { //属于插件pluginid为786690的传感器
                                let jj = 0; //用于告警数的计数

                                let gear_status; //档位状态
                                if (value["786489"] == 0) {
                                    gear_status = "停机";
                                } else if (value["786489"] == 1) {
                                    gear_status = "手动";
                                } else if (value["786489"] == 2) {
                                    gear_status = "自动";
                                } else if (value["786489"] == 3) {
                                    gear_status = "测试";
                                } else {
                                    gear_status = "error";
                                }
                                data[i]["786489"] = gear_status;


                                $.each(more_float_arr2, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786494) {
                                            if (value["786494"] == 20000) {
                                                data[i]["786494"] = "-";
                                            } else {
                                                data[i]["786494"] = value["786494"].toFixed(2);
                                            }
                                        } else if (val == 786495) {
                                            if (value["786495"] == 20000) {
                                                data[i]["786495"] = "-";
                                            } else {
                                                data[i]["786495"] = value["786495"].toFixed(2);
                                            }
                                        } else if (val == 786496) {
                                            if (value["786496"] == 20000) {
                                                data[i]["786496"] = "-";
                                            } else {
                                                data[i]["786496"] = value["786496"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786497) {
                                            if (value["786497"] == 20000) {
                                                data[i]["786497"] = "-";
                                            } else {
                                                data[i]["786497"] = value["786497"].toFixed(2);
                                            }
                                        } else if (val == 786498) {
                                            if (value["786498"] == 20000) {
                                                data[i]["786498"] = "-";
                                            } else {
                                                data[i]["786498"] = value["786498"].toFixed(2);
                                            }
                                        } else if (val == 786487) {
                                            if (value["786487"] == 20000) {
                                                data[i]["786487"] = "-";
                                            } else {
                                                data[i]["786487"] = value["786487"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786447) {
                                            if (value["786447"] == 20000) {
                                                data[i]["786447"] = "-";
                                            } else {
                                                data[i]["786447"] = value["786447"].toFixed(2);
                                            }
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }


                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr2, function (n, val) {
                                    if (value[val] == true) {
                                        jj++;
                                    }
                                });
                                data[i]["numbersa"] = jj;
                                if (that.$data.alternator_status2 == 1) {
                                    that.fresh_alternator_data2(786690, that.$data.alternator_deviceid2);
                                    that.fresh_alternator_more_data2(786690, that.$data.alternator_deviceid2);
                                }
                                that.$data.alternatorAlarm2 = data;
                            }

                        });

                    },
                    error: function (realdata) {
                    }
                });
            } else {

                $.ajax({
                    url: 'cgi-bin/JHMonitoring.cgi',
                    type: 'post',
                    cache: false,
                    async: false,
                    data: JSON.stringify(real_msg),
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");

                        let float_arr1 = show_alternator_float_param1();
                        let more_float_arr1 = show_alternator_more_float_param1();
                        let more_float_arr2 = show_alternator_more_float_param2();
                        let boole_arr1 = show_alternator_boole_param1();
                        let boole_arr2 = show_alternator_boole_param2();

                        $.each(data, function (i, value) {
                            //i:deviceid,value:数据组
                            //数组为空/数组中不含有该值，则返回 -1
                            var index1 = $.inArray(parseInt(i), alternator_arr1);
                            var index2 = $.inArray(parseInt(i), alternator_arr2);
                            if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                let ii = 0; //用于告警数的计数


                                let gear_status; //档位状态
                                if (value["786489"] == 0) {
                                    gear_status = "停机";
                                } else if (value["786489"] == 1) {
                                    gear_status = "手动";
                                } else if (value["786489"] == 2) {
                                    gear_status = "自动";
                                } else if (value["786489"] == 3) {
                                    gear_status = "测试";
                                } else {
                                    gear_status = "error";
                                }
                                data[i]["786489"] = gear_status;


                                $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786443) {
                                            if (value["786443"] == 20000) {
                                                data[i]["786443"] = "-";
                                            } else {
                                                data[i]["786443"] = value["786443"].toFixed(2);
                                            }
                                        } else if (val == 786444) {
                                            if (value["786444"] == 20000) {
                                                data[i]["786444"] = "-";
                                            } else {
                                                data[i]["786444"] = value["786444"].toFixed(2);
                                            }
                                        } else if (val == 786445) {
                                            if (value["786445"] == 20000) {
                                                data[i]["786445"] = "-";
                                            } else {
                                                data[i]["786445"] = value["786445"].toFixed(2);
                                            }
                                        } else if (val == 786487) { //整型
                                            data[i][val] = value[val];
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }

                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr1, function (n, val) {
                                    if (value[val] == true) {
                                        ii++;
                                    }
                                });
                                data[i]["numbersa"] = ii;
                                if (that.$data.alternator_status == 1) {
                                    that.fresh_alternator_data(786689, that.$data.alternator_deviceid);
                                    that.fresh_alternator_more_data(786689, that.$data.alternator_deviceid);
                                }
                                that.$data.alternatorAlarm = data;
                            }

                            if (index2 >= 0) { //属于插件pluginid为786690的传感器
                                let jj = 0; //用于告警数的计数

                                let gear_status; //档位状态
                                if (value["786489"] == 0) {
                                    gear_status = "停机";
                                } else if (value["786489"] == 1) {
                                    gear_status = "手动";
                                } else if (value["786489"] == 2) {
                                    gear_status = "自动";
                                } else if (value["786489"] == 3) {
                                    gear_status = "测试";
                                } else {
                                    gear_status = "error";
                                }
                                data[i]["786489"] = gear_status;


                                $.each(more_float_arr2, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786494) {
                                            if (value["786494"] == 20000) {
                                                data[i]["786494"] = "-";
                                            } else {
                                                data[i]["786494"] = value["786494"].toFixed(2);
                                            }
                                        } else if (val == 786495) {
                                            if (value["786495"] == 20000) {
                                                data[i]["786495"] = "-";
                                            } else {
                                                data[i]["786495"] = value["786495"].toFixed(2);
                                            }
                                        } else if (val == 786496) {
                                            if (value["786496"] == 20000) {
                                                data[i]["786496"] = "-";
                                            } else {
                                                data[i]["786496"] = value["786496"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786497) {
                                            if (value["786497"] == 20000) {
                                                data[i]["786497"] = "-";
                                            } else {
                                                data[i]["786497"] = value["786497"].toFixed(2);
                                            }
                                        } else if (val == 786498) {
                                            if (value["786498"] == 20000) {
                                                data[i]["786498"] = "-";
                                            } else {
                                                data[i]["786498"] = value["786498"].toFixed(2);
                                            }
                                        } else if (val == 786487) {
                                            if (value["786487"] == 20000) {
                                                data[i]["786487"] = "-";
                                            } else {
                                                data[i]["786487"] = value["786487"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786447) {
                                            if (value["786447"] == 20000) {
                                                data[i]["786447"] = "-";
                                            } else {
                                                data[i]["786447"] = value["786447"].toFixed(2);
                                            }
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }


                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr2, function (n, val) {
                                    if (value[val] == true) {
                                        jj++;
                                    }
                                });
                                data[i]["numbersa"] = jj;
                                if (that.$data.alternator_status2 == 1) {
                                    that.fresh_alternator_data2(786690, that.$data.alternator_deviceid2);
                                    that.fresh_alternator_more_data2(786690, that.$data.alternator_deviceid2);
                                }
                                that.$data.alternatorAlarm2 = data;
                            }

                        });

                    },
                    error: function (realdata) {
                    }
                });
            }
        },

        get_leakage_info() { //获取漏电模块的实时数据
            let that = this;
            let leakage_arr1 = this.$data.leakageArr1;
            let leakage_arr2 = this.$data.leakageArr2;
            let real_msg = {
                "devicelist": this.$data.leakage_arr
            };

            if (window.sessionStorage.getItem('username') == "zyl") {
                $.ajax({
                    url: '../static/get_power_leakage.json',
                    type: 'GET',
                    cache: false,
                    async: false,
                    dataType: 'text',
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");

                        let float_arr1 = show_leakage_float_param1();
                        let more_float_arr1 = show_leakage_more_float_param2();

                        $.each(data, function (i, value) {
                            //i:deviceid,value:数据组
                            //数组为空/数组中不含有该值，则返回 -1
                            var index1 = $.inArray(parseInt(i), leakage_arr1);
                            var index2 = $.inArray(parseInt(i), leakage_arr2);
                            if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                let ii = 0; //用于告警数的计数
                                data[i]["852225"] = gear_status;

                                $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786443) {
                                            if (value["786443"] == 20000) {
                                                data[i]["786443"] = "-";
                                            } else {
                                                data[i]["786443"] = value["786443"].toFixed(2);
                                            }
                                        } else if (val == 786444) {
                                            if (value["786444"] == 20000) {
                                                data[i]["786444"] = "-";
                                            } else {
                                                data[i]["786444"] = value["786444"].toFixed(2);
                                            }
                                        } else if (val == 786445) {
                                            if (value["786445"] == 20000) {
                                                data[i]["786445"] = "-";
                                            } else {
                                                data[i]["786445"] = value["786445"].toFixed(2);
                                            }
                                        } else if (val == 786487) { //整型
                                            data[i][val] = value[val];
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }

                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr1, function (n, val) {
                                    if (value[val] == true) {
                                        ii++;
                                    }
                                });
                                data[i]["numbersa"] = ii;
                                if (that.$data.alternator_status == 1) {
                                    that.fresh_alternator_data(786689, that.$data.alternator_deviceid);
                                    that.fresh_alternator_more_data(786689, that.$data.alternator_deviceid);
                                }
                                that.$data.alternatorAlarm = data;
                            }

                            if (index2 >= 0) { //属于插件pluginid为786690的传感器
                                let jj = 0; //用于告警数的计数

                                let gear_status; //档位状态
                                if (value["786489"] == 0) {
                                    gear_status = "停机";
                                } else if (value["786489"] == 1) {
                                    gear_status = "手动";
                                } else if (value["786489"] == 2) {
                                    gear_status = "自动";
                                } else if (value["786489"] == 3) {
                                    gear_status = "测试";
                                } else {
                                    gear_status = "error";
                                }
                                data[i]["786489"] = gear_status;


                                $.each(more_float_arr2, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786494) {
                                            if (value["786494"] == 20000) {
                                                data[i]["786494"] = "-";
                                            } else {
                                                data[i]["786494"] = value["786494"].toFixed(2);
                                            }
                                        } else if (val == 786495) {
                                            if (value["786495"] == 20000) {
                                                data[i]["786495"] = "-";
                                            } else {
                                                data[i]["786495"] = value["786495"].toFixed(2);
                                            }
                                        } else if (val == 786496) {
                                            if (value["786496"] == 20000) {
                                                data[i]["786496"] = "-";
                                            } else {
                                                data[i]["786496"] = value["786496"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786497) {
                                            if (value["786497"] == 20000) {
                                                data[i]["786497"] = "-";
                                            } else {
                                                data[i]["786497"] = value["786497"].toFixed(2);
                                            }
                                        } else if (val == 786498) {
                                            if (value["786498"] == 20000) {
                                                data[i]["786498"] = "-";
                                            } else {
                                                data[i]["786498"] = value["786498"].toFixed(2);
                                            }
                                        } else if (val == 786487) {
                                            if (value["786487"] == 20000) {
                                                data[i]["786487"] = "-";
                                            } else {
                                                data[i]["786487"] = value["786487"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786447) {
                                            if (value["786447"] == 20000) {
                                                data[i]["786447"] = "-";
                                            } else {
                                                data[i]["786447"] = value["786447"].toFixed(2);
                                            }
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }


                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr2, function (n, val) {
                                    if (value[val] == true) {
                                        jj++;
                                    }
                                });
                                data[i]["numbersa"] = jj;
                                if (that.$data.alternator_status2 == 1) {
                                    that.fresh_alternator_data2(786690, that.$data.alternator_deviceid2);
                                    that.fresh_alternator_more_data2(786690, that.$data.alternator_deviceid2);
                                }
                                that.$data.alternatorAlarm2 = data;
                            }

                        });

                    },
                    error: function (realdata) {
                    }
                });
            } else {

                $.ajax({
                    url: 'cgi-bin/JHMonitoring.cgi',
                    type: 'post',
                    cache: false,
                    async: false,
                    data: JSON.stringify(real_msg),
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");

                        let float_arr1 = show_alternator_float_param1();
                        let more_float_arr1 = show_alternator_more_float_param1();
                        let more_float_arr2 = show_alternator_more_float_param2();
                        let boole_arr1 = show_alternator_boole_param1();
                        let boole_arr2 = show_alternator_boole_param2();

                        $.each(data, function (i, value) {
                            //i:deviceid,value:数据组
                            //数组为空/数组中不含有该值，则返回 -1
                            var index1 = $.inArray(parseInt(i), alternator_arr1);
                            var index2 = $.inArray(parseInt(i), alternator_arr2);
                            if (index1 >= 0) { //属于插件pluginid为786689的传感器
                                let ii = 0; //用于告警数的计数


                                let gear_status; //档位状态
                                if (value["786489"] == 0) {
                                    gear_status = "停机";
                                } else if (value["786489"] == 1) {
                                    gear_status = "手动";
                                } else if (value["786489"] == 2) {
                                    gear_status = "自动";
                                } else if (value["786489"] == 3) {
                                    gear_status = "测试";
                                } else {
                                    gear_status = "error";
                                }
                                data[i]["786489"] = gear_status;


                                $.each(more_float_arr1, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786443) {
                                            if (value["786443"] == 20000) {
                                                data[i]["786443"] = "-";
                                            } else {
                                                data[i]["786443"] = value["786443"].toFixed(2);
                                            }
                                        } else if (val == 786444) {
                                            if (value["786444"] == 20000) {
                                                data[i]["786444"] = "-";
                                            } else {
                                                data[i]["786444"] = value["786444"].toFixed(2);
                                            }
                                        } else if (val == 786445) {
                                            if (value["786445"] == 20000) {
                                                data[i]["786445"] = "-";
                                            } else {
                                                data[i]["786445"] = value["786445"].toFixed(2);
                                            }
                                        } else if (val == 786487) { //整型
                                            data[i][val] = value[val];
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }

                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr1, function (n, val) {
                                    if (value[val] == true) {
                                        ii++;
                                    }
                                });
                                data[i]["numbersa"] = ii;
                                if (that.$data.alternator_status == 1) {
                                    that.fresh_alternator_data(786689, that.$data.alternator_deviceid);
                                    that.fresh_alternator_more_data(786689, that.$data.alternator_deviceid);
                                }
                                that.$data.alternatorAlarm = data;
                            }

                            if (index2 >= 0) { //属于插件pluginid为786690的传感器
                                let jj = 0; //用于告警数的计数

                                let gear_status; //档位状态
                                if (value["786489"] == 0) {
                                    gear_status = "停机";
                                } else if (value["786489"] == 1) {
                                    gear_status = "手动";
                                } else if (value["786489"] == 2) {
                                    gear_status = "自动";
                                } else if (value["786489"] == 3) {
                                    gear_status = "测试";
                                } else {
                                    gear_status = "error";
                                }
                                data[i]["786489"] = gear_status;


                                $.each(more_float_arr2, function (n, val) { //n:key,val:元素属性
                                    if (typeof (value[val]) == "number") {
                                        if (val == 786494) {
                                            if (value["786494"] == 20000) {
                                                data[i]["786494"] = "-";
                                            } else {
                                                data[i]["786494"] = value["786494"].toFixed(2);
                                            }
                                        } else if (val == 786495) {
                                            if (value["786495"] == 20000) {
                                                data[i]["786495"] = "-";
                                            } else {
                                                data[i]["786495"] = value["786495"].toFixed(2);
                                            }
                                        } else if (val == 786496) {
                                            if (value["786496"] == 20000) {
                                                data[i]["786496"] = "-";
                                            } else {
                                                data[i]["786496"] = value["786496"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786497) {
                                            if (value["786497"] == 20000) {
                                                data[i]["786497"] = "-";
                                            } else {
                                                data[i]["786497"] = value["786497"].toFixed(2);
                                            }
                                        } else if (val == 786498) {
                                            if (value["786498"] == 20000) {
                                                data[i]["786498"] = "-";
                                            } else {
                                                data[i]["786498"] = value["786498"].toFixed(2);
                                            }
                                        } else if (val == 786487) {
                                            if (value["786487"] == 20000) {
                                                data[i]["786487"] = "-";
                                            } else {
                                                data[i]["786487"] = value["786487"].toFixed(2);
                                            }
                                        } else if (val == 786435) {
                                            if (value["786435"] == 20000) {
                                                data[i]["786435"] = "-";
                                            } else {
                                                data[i]["786435"] = value["786435"].toFixed(2);
                                            }
                                        } else if (val == 786447) {
                                            if (value["786447"] == 20000) {
                                                data[i]["786447"] = "-";
                                            } else {
                                                data[i]["786447"] = value["786447"].toFixed(2);
                                            }
                                        } else {
                                            data[i][val] = value[val].toFixed(2);
                                        }


                                    } else {
                                        data[i][val] = "error";
                                    }
                                });
                                $.each(boole_arr2, function (n, val) {
                                    if (value[val] == true) {
                                        jj++;
                                    }
                                });
                                data[i]["numbersa"] = jj;
                                if (that.$data.alternator_status2 == 1) {
                                    that.fresh_alternator_data2(786690, that.$data.alternator_deviceid2);
                                    that.fresh_alternator_more_data2(786690, that.$data.alternator_deviceid2);
                                }
                                that.$data.alternatorAlarm2 = data;
                            }

                        });

                    },
                    error: function (realdata) {
                    }
                });
            }
        },

        get_batterySonsor_info() { //获取蓄电池智能传感器的实时数据

        },
        get_electricMonitor_info() { //获取电量监测器的实时数据
            let that = this;
            let ups_arr2 = this.$data.upsArr2;
            let real_msg = {
                "devicelist": this.$data.ups_arr
            };

            if (window.sessionStorage.getItem('username') == "zyl") {
                $.ajax({
                    url: '../static/get_env_real_electricMoitor.json',
                    type: 'GET',
                    cache: false,
                    async: false,
                    dataType: 'text',
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");
                        $.each(data, function (i, value) {
                            var index = $.inArray(parseInt(i), that.$data.electricMoitorAtrr1);
                            if (index >= 0) { //属于插件pluginid为983297(主)的传感器
                                let more_float_arr1 = ["983041","983042","983043","983044","983045","983046"];

                                $.each(more_float_arr1, function (n, val) {
                                    if (typeof (value[val]) == "number") {
                                        data[i][val] = value[val].toFixed(1);
                                    } else {
                                        data[i][val] = "error";
                                    }
                                })
                            } else { //属于插件pluginid为983298(从)的传感器
                                let more_float_arr2 =["983296","983297","983298","983299","983300","983301",
                                    "983302","983303","983304","983305","983306","983307","983308","983309",
                                    "983310","983311","983312","983313","983314","983315","983316","983317","" +
                                    "983318","983319","983320","983321","983322","983323","983324","983325",
                                    ,"983326","983327","983328","983329","983330","983331","983332","983333",
                                    "983334","983335","983336","983337","983338","983339","983340","983341","983342","983343"];
                                $.each(more_float_arr2, function (n, val) {
                                    if (typeof (value[val]) == "number") {
                                        data[i][val] = value[val].toFixed(1);
                                    } else {
                                        data[i][val] = "error";
                                    }
                                })
                            }
                        });
                        that.$data.electricMonitorAlarm = data;
                        that.$data.electricMonitorAlarm2 = data;
                    },
                    error: function (realdata) {
                    }
                });
            } else {
                $.ajax({
                    url: 'cgi-bin/JHMonitoring.cgi',
                    type: 'post',
                    cache: false,
                    async: false,
                    data: JSON.stringify(real_msg),
                    success: function (realdata) {
                        let data = eval("(" + realdata + ")");
                        $.each(data, function (i, value) {
                            var index = $.inArray(parseInt(i), that.$data.electricMoitorAtrr1);
                            if (index >= 0) { //属于插件pluginid为983297(主)的传感器
                                let more_float_arr1 = ["983041","983042","983043","983044","983045","983046"];
                                $.each(more_float_arr1, function (n, val) {
                                    if (typeof (value[val]) == "number") {
                                        data[i][val] = value[val].toFixed(1);
                                    } else {
                                        data[i][val] = "error";
                                    }
                                })
                            } else { //属于插件pluginid为983298(从)的传感器
                                let more_float_arr2 =["983296","983297","983298","983299","983300","983301",
                                    "983302","983303","983304","983305","983306","983307","983308","983309",
                                    "983310","983311","983312","983313","983314","983315","983316","983317","" +
                                    "983318","983319","983320","983321","983322","983323","983324","983325",
                                    ,"983326","983327","983328","983329","983330","983331","983332","983333",
                                    "983334","983335","983336","983337","983338","983339","983340","983341","983342","983343"];
                                $.each(more_float_arr2, function (n, val) {
                                    if (typeof (value[val]) == "number") {
                                        data[i][val] = value[val].toFixed(1);
                                    } else {
                                        data[i][val] = "error";
                                    }
                                })
                            }
                        });
                        that.$data.electricMonitorAlarm = data;
                        that.$data.electricMonitorAlarm2 = data;
                    },
                    error: function (realdata) {
                    }
                });
            }
        },

    },
    mounted() {
        this.check_pwd();
        this.get_info();
        setTimeout(this.moves, 500)
    },
    beforeCreate() { //用于设置下行设备时清除定时器
        window.three_interval = "";
        window.ups_interval = "";
        window.electric_interval = "";
        window.alternator_interval = "";
        window.leakage_interval = "";
        window.batterySensor_interval = "";
        window.electricMonitor_interval = "";
    },
    created() {
    },
    watch: {
        three_arr: function () {
            if (this.$data.three_arr.length != 0) {
                three_interval = setInterval(this.get_three_info, 2000);
                setTimeout(three_interval, 2000);
            }
        },
        ups_arr: function () {
            if (this.$data.ups_arr.length != 0) {
                ups_interval = setInterval(this.get_ups_info, 2000)
                setTimeout(ups_interval, 2000);
            }
        },
        electric_arr: function () {
            if (this.$data.electric_arr.length != 0) {
                electric_interval = setInterval(this.get_electric_info, 2000);
                setTimeout(electric_interval, 2000);
            }
        },
        alternator_arr: function () {
            if (this.$data.alternator_arr.length != 0) {
                alternator_interval = setInterval(this.get_alternator_info, 2000);
                setTimeout(alternator_interval, 2000);
            }
        },
        leakage_arr: function () {
            if (this.$data.leakage_arr.length != 0) {
                leakage_interval = setInterval(this.get_leakage_info, 2000);
                setTimeout(leakage_interval, 2000);
            }
        },
        batterySensor_arr: function () {
            if (this.$data.batterSensor_att.length != 0) {
                batterySensor_interval = setInterval(this.get_batterySonsor_info, 2000);
            }
        },
        electricMonitor_arr: function () {
            if (this.$data.electricMonitor_arr.lenght != 0) {
                electricMonitor_interval = setInterval(this.get_electricMonitor_info, 2000);
            }
        }

    },
    beforeDestroy() { //页面关闭前清掉计时器
        clearInterval(three_interval);
        clearInterval(ups_interval);
        clearInterval(electric_interval);
        clearInterval(alternator_interval);
        clearInterval(batterySensor_interval);
        clearInterval(electricMonitor_interval);
    }

}
</script>
<style>
    .power {
        width: 825px;
        height: 1017px;
        margin: auto;
        margin-top: 5%;
        background: url(../../assets/pingyu.jpg) center no-repeat;
        position: relative;
        min-width: 800px;
    }

    .power ul {
        width: 100%;
        height: 100%;
        margin-top: -1.5%;
        position: relative;
    }

    .power ul li {
        position: absolute;
        left: 0px;
        top: 0px;
        cursor: move;
        border: 1px solid #d2d2d2;
        background: #fff;
        border-radius: 5px;
        overflow: visible;
    }

    .power ul .powerBox {
        background: #fff;
        opacity: 0.9;
        width: 150px;
        border-radius: 8px;
    }

    .power-header-box {

        /* background: #0080c0;
		text-align: center;
		color: #fff;
		height:25px;
		line-height: 25px;
		letter-spacing: 1px;
		font-size: 15px;
		font-weight: 800;

		overflow: hidden;/*内容超出后隐藏*/
        text-overflow: ellipsis;
        /* 超出内容显示为省略号*/
        white-space: nowrap;
        /*文本不进行换行*/

        width: 100%;
        text-align: center;
        height: 30px;
        font-size: 16px;
        line-height: 30px;
        color: #0080C0;
        font-weight: 600;
        letter-spacing: 2px;
    }

    .power .powerbtn,
    .batterybtn,
    .threebtn {
        font-size: 14px;
        text-align: center;
        height: 20px;
        line-height: 20px;
    }

    .power .powerbtn:hover,
    .batterybtn:hover,
    .threebtn:hover {
        color: #0080C0;
        cursor: pointer;
    }

    .power .header-box {
        width: 90px;
        text-align: center;
        height: 20px;
        font-size: 14px;
        background: #0080C0;
        color: #fff;
        overflow: hidden;
        /*内容超出后隐藏*/
        text-overflow: ellipsis;
        /* 超出内容显示为省略号*/
        white-space: nowrap;
        /*文本不进行换行*/
    }

    .power .header-content {
        width: 90px;
        height: 40px;
        text-align: center;
        line-height: 40px;
    }

    .power .el-table--mini td,
    .el-table--mini th {
        padding: 0px;
        text-align: center;
    }

    .power .el-table--border::after,
    .el-table--group::after,
    .el-table::before {
        z-index: 0;
    }

    .buttons-box {
        width: 100px;
        height: 40px;
        position: fixed;
        right: 50px;
        top: 100px;
        text-align: center;
        line-height: 40px;
    }

    .buttons-box .el-button {
        width: 80px;
        font-size: 15px;
        letter-spacing: 2px;
        height: 30px;
        line-height: 30px;
        padding: 0px;
    }

    .el-badge {
        position: absolute;
        right: -45px;
        top: 26px;
    }

    .threeBox .el-table:before {
        height: 0px;
    }
</style>
